I was reading over the PHP Documentation for Arrays and i so use to making arrays the way I learned them... PHP: $cash = ("I have lot of"," cash in my pocket"); But while reading over the docs , I see a whole new syntax look! PHP: <?php$array = array( "foo" => "bar", 42 => 24, "multi" => array( "dimensional" => array( "array" => "foo" ) ));var_dump($array["foo"]);var_dump($array[42]);var_dump($array["multi"]["dimensional"]["array"]);?> As You can see I don't understand thios at all!! What I think it means is PHP: <?php$array = array( //starg of the array "foo" => "bar", // [0] replacement 42 => 24, // replecing [1] "multi" => array( // Fucking lost! "dimensional" => array( "array" => "foo" ) ));var_dump($array["foo"]); // will display variables in "foo" array section ?var_dump($array[42]);var_dump($array["multi"]["dimensional"]["array"]);?> Halp Meh? <3
PHP arrays are actually like maps in Java. The keys can be string and/or int. "foo" => "bar" is equivalent to a map entry with String key foo and String value bar. If strings and ints are used together as keys, ints will be casted into strings.