How im initialize array in php. If im doing foreach and set 0 on every member so the $key still exists.. Thank u all , ur gr8 people!
$data = array ( "Item 1", "Item 2" ); $data = array ( "Key_1" => "Item 1", "Key_2" => "Item 2" ); $data["key_1"] = "Item 1"; $data["key_2"] = "Item 2"; PHP: Take your pick ......
I dunno what you mean by 'initialize it with foreach', but foreach syntax works like : foreach( $array as $key => $value ) { if($key == "whatever") echo "do the thing\n"; } PHP: