php - Printing also the duplicate in an array -
this question has answer here:
- php associative array duplicate keys 4 answers
i wonder why don't 3 elements of array.
$array1 = array( "one" => 1, "two" => 2, "one" => 1 ); when print it:
echo 'array1:<pre>'; print_r($array1); echo '</pre>'; i this:
array1: array ( [one] => 1 [two] => 2 ) this not want. need show following:
array1: array ( [one] => 1 [two] => 2 [one] => 1 ) any wil appreciated. in advance
your array set of key/value pairs. think of dictionary:
array( "elephant" => "big grey animal tusks", "canary" => "little yellow bird", "elephant" => "candy tastes skittles" ) when print one, second definition of "elephant", in code. try changing second "one" => 1 "one" => 77.
because php reads top-down, last 1 final answer, in variables.
Comments
Post a Comment