array get only the value without duplicate
<?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:
- Create Laravel Project 7
- add 10 days to date in php
- autoload file in laravel
- array length php
- cambiar entre versiones de php linux
- The key "initial" is not recognized and ignored.
- Connect to SQL in a php PDO and print the data in it
- am pm time php
- email configuration for gmail in laravel
- factorial function php
- display errors in php
- blob image to base64 php
- 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))
- download laravel composer
- composer require laravel/ui for laravel 6
- base64 encode username password php example
- array_combine function in php
- advanced custom field repeater
- date to string php
- date time stamp php
- date format php sql
- clear everything laravel
- create new laravel project 8
- curent date and time php