get value from array 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));
?>
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: javascript get array value
var array = []
array[0] = "hi"
array[1] = "dude"
var done = false
while (done == false){
var valueToFind = "hi";
var rounds = array.length;
if (rounds < 0){
return false
}
if (array[rounds] == valueToFind){
done = true
return rounds
}
rounds = rounds - 1
}