filter array if duplicates php
<?php
$fruits_list = array('Orange', 'Apple', ' Banana', 'Cherry', ' Banana');
$result = array_unique($fruits_list);
print_r($result);
?>
Output:
Array ( [0] => Orange [1] => Apple [2] => Banana [3] => Cherry ) function has_dupes($array) {
$dupe_array = array();
foreach ($array as $val) {
if (++$dupe_array[$val] > 1) {
return true;
}
}
return false;
}
Also in PHP:
- current domain in php
- DATE_FORMAT(STR_TO_DATE
- Undefined offset: 0 at laravel\framework\src\Illuminate\Routing\Router.php
- case upper php
- contains in php string
- add to hours to variable date php
- add day to php date
- am pm time format in php
- convert timestamp to date format php
- add 1 day to the some date
- clear config cache laravel 5
- composer takes older version of php
- Allowed memory size of 536870912 bytes exhausted (tried to allocate 264245248 bytes) http://localhost:8000/createProduct
- create seeder laravel
- alpha numeric to upper case in php
- 2 = null laravel
- count charctor in php
- error reporting php all
- echo in php console log
- date 'F' what is it
- check is char exist in stirng php
- check if string contains substring php 8
- check if key is already exist in an associative array php
- date format function in php