array unique removing key
<?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 ) $arr = array(1, 4, 6, 1, 8, 9, 4, 6);
$unique = array_unique($arr);
$duplicates = array_diff_assoc($arr, $unique);
print_r($duplicates);
Array ( [3] => 1 [6] => 4 [7] => 6 )
Also in PHP:
- count string length in php
- advanced custom field repeater
- doctrine where
- check typeof variable php
- date to string php
- date time sql format php
- current datetime php
- How to execute “php artisan migrate” and other Laravel commands in remote server?
- HOW TO GET LAST INSERTED ID FROM TABLE IN SQL IN CODEIGNITER
- Laravel Eloquent, group by month/year
- date math sql php
- $errors show this error in laravel
- composer remove laravel
- add one day to date in php
- 7 reasons why Lee is an idiot
- Route [login] not defined.Route [login] not defined.
- datetime format laravel
- check if word exist in string
- create new project in laravel
- build laravel project
- Str::random
- day in php time
- detect keyword of php string
- date format php sql