delete duplicates array 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 ) <?php
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
?>
Array
(
[a] => green
[0] => red
[1] => blue
)$str = implode(',',array_unique(explode(',', $str)));
Also in PHP:
- file in array
- cache:clear php artisan
- eloquent seeder
- SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; m ax key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`e mail`))
- console() php
- date() function php
- date time format year php
- PHP Fatal error: Composer detected issues in your platform: Your Composer depen dencies require a PHP version ">= 7.3.0". You are running 7.2.34.
- echo day php
- back route laravel
- date du jour en php
- artisan clear commands
- check if key of array key true or false php
- determine type in function php
- artisan show routes
- find first occurance of sentence in a string php
- date method php
- excerpt custom post type
- Created Migration: laravel
- download php7.4 aptget
- clear cache laravel project
- doctrine getrepository findby
- $age = 20; print ($age >= 18) ? "Adult" : "Not Adult";
- failed to clear cache laravel