array_value php code example

Example 1: array values php

<?php
  
$array = array("size" => "XL", "color" => "gold");

print_r(array_values($array));

?>

Example 2: php array_values

<?php
$array = array("size" => "XL", "color" => "gold");
print_r(array_values($array));
?>
// ["XL","gold"]

Example 3: array_values() in php

PHP array_values() is an inbuilt function that returns all the values of an array and not the keys. The array_values() function returns the array containing all the values of an array. The returned array will have the numeric keys, starting at 0 and increase by 1

<?php
$a=array("Name"=>"ankur","Age"=>"25","Country"=>"India");
print_r(array_values($a));
?>
  
Output:
Array ( [0] => ankur [1] => 25 [2] => India )
  
for more visit: 
https://appdividend.com/2019/05/09/php-array-values-example-php-array_values-function-tutorial/#:~:text=PHP%20array_values()%20is%20an,0%20and%20increase%20by%201.
https://www.w3schools.com/php/func_array_values.asp

/*
I hope it will help you.
Thank you _/\_
*/

Tags:

Php Example