Answers for "how to assign key for array element in 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
0

php array push key value

<?php
$image[0] = $image[0].','.$filename;
?>
Posted by: Guest on October-21-2020

Code answers related to "how to assign key for array element in php ?"

Browse Popular Code Answers by Language