Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php variables as keys in arrays

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

print_r($arr);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #variables #keys #arrays
ADD COMMENT
Topic
Name
3+5 =