Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php add to array if not exists

$a=array();
// organize the array
foreach($array as $k=>$v){
    foreach($v as $key=>$value){
        if(!in_array($value, $a)){
        	$a[]=$value;
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: validate time in laravel 
Php :: asset not working in laravel 
Php :: php remove html tags 
Php :: wordpress get permalink in loop 
Php :: Composer detected issues in your platform: Your Composer dependencies require a PHP version "= 8.0.2". 
Php :: php reader read date from excel 
Php :: php mongodb get all documents 
Php :: Displaying all table names in php from MySQL database 
Php :: add id to route name in laravel blade 
Php :: option value selected in laravel blade 
Php :: codeigniter query builder order by 
Php :: php get query params 
Php :: run raw sql with doctrine manager 
Php :: add column in existing table in laravel 
Php :: php set x-frame-options 
Php :: clear session php 
Php :: acf get user form field 
Php :: how to use dompdf in laravel 
Php :: datetime iso 8601 php 
Php :: how to request user input in php 
Php :: in loop how add string by comma in php 
Php :: wordpress wp_enqueue_script footer 
Php :: remove symbolsand spaces php 
Php :: grenerating random text color for text for image php 
Php :: php while loop of alphabet 
Php :: mt_rand 
Php :: laravel blade skip entry 
Php :: publish config laravel 
Php :: convert to int php 
Php :: Session store not set on request. 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =