get value of array php code example
Example 1: php get all values from array
array_values(array)
Example 2: php array_values
<?php
$array = array("size" => "XL", "color" => "gold");
print_r(array_values($array));
?>
// ["XL","gold"]
Example 3: php return array
<?php
function data() {
$out[0] = "abc";
$out[1] = "def";
$out[2] = "ghi";
return $out;
}
$data = data();
foreach($data as $items){
echo $items;
}
Example 4: php take out 2 level array key value
foreach($bigArray as $array){
foreach($array as $key=>$value){
echo $key;
}
}