Answers for "make key as value for associative array php"

PHP
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 "make key as value for associative array php"

Browse Popular Code Answers by Language