0

Which of the following correctly sets up a PHP array??

  1. array() = $array_values[];

  2. $array_values = array();

  3. array() = $array_values[];

  4. $array_values = new array();

4
Contributors
5
Replies
7
Views
5 Years
Discussion Span
Last Post by napninjanx
0
$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

Edited by Biiim

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.