Answers for "php get array value by function"

PHP
1

php array_values

<?php
$array = array("size" => "XL", "color" => "gold");
print_r(array_values($array));
?>
// ["XL","gold"]
Posted by: Guest on April-15-2020
1

php variables as keys in arrays

$id = 1;
$age = 2;    
$sort = "id"; // or "age";
    $Key = $$sort;
$arr = array($Key => 'string');

print_r($arr);
Posted by: Guest on August-13-2020

Code answers related to "php get array value by function"

Browse Popular Code Answers by Language