How can PHP return all values in an array?
In PHP, you can use the array_values() function to return all the values of an array. This function will return a new indexed array containing all the values from the original array.
Here is an example code:
$array = array('apple', 'banana', 'orange');
$values = array_values($array);
print_r($values);
The output result is:
Array
(
[0] => apple
[1] => banana
[2] => orange
)
In the example above, array(‘apple’, ‘banana’, ‘orange’) is an associative array. Use the array_values() function to convert it into an indexed array, and print out all the values using the print_r() function.