add unique value in 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
)
Also in PHP:
- associative array example
- check if includes numbers php
- check characters php
- convert json to array php
- echo message or display default message php
- Warning: func_get_arg() expects exactly 1 parameter, 0 given in
- crete new project in laravel
- ReactPHP
- executar comando linux php
- encrypt decrypt php
- display errors off php
- catching error php
- check if letter is in string php
- Best code editors for php
- add checkbox in server side datatable laravel
- Call to undefined function App\Models\str_slug()
- array unique values
- composer global laravel
- contains function in php
- clear all laravel caches
- ddev laravel setup
- array in array php foreach
- You want to develop a Laravel application on your Windows machine. For this, you installed the Laravel framework on your system. In which of the following scenarios, Laravel will not run on your system?
- eloquent run seeder