Which of the following correctly sets up a PHP array??
array() = $array_values[];
$array_values = array();
array() = $array_values[];
$array_values = new array();
Which of the following correctly sets up a PHP array??
array() = $array_values[];
$array_values = array();
array() = $array_values[];
$array_values = new array();
I think It's 2 right?
$array = array();
you don't need to declare before hand either you can use:
$array[] = $value;//add to end
$array[2] = $value;//add/overwrite entry with key of 2
1, 3 and 4 are wrong in php, 4 is the javascript to declare an array and 2 is correct
yeap...2 is correct.
Thanks for the info.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.