? Php $ arrayarray (a, B, c); defines an array $ array [] Simon; adds a new array element print_r ($ array); Outputs An array ?? Php $ arrayarray (a, B, c); defines an array $ array [9] Simon; adds a new array element print_r ($ array); Outputs An array ?? Create
? Php $ array = array ("a", "B", "c"); // defines an array $ array [] = "Simon "; // Add a new array element print_r ($ array); // output array? ? Php $ array = array ("a", "B", "c"); // defines an array $ array [9] = "Simon "; // Add a new array element print_r ($ array); // output array? ? Php // create
<? Php $ array = array ("a", "B", "c"); // defines an array $ array [] = "Simon "; // Add a new array element print_r ($ array); // output array?>
<? Php $ array = array ("a", "B", "c"); // defines an array $ array [9] = "Simon "; // Add a new array element print_r ($ array); // output array?>
<? Php // create a simple array $ array = array (0 => 1, 1 => 2, 2 => 3, 3 => 4, 6 => 5 ); print_r ($ array); // update the value of 2 in the array to 100 $ array [2] = 100; print_r ($ array ); // Add a key $ array ["X"] = 50; print_r ($ array); // delete all keys now, but keep the structure of the array foreach ($ array as $ I =>$ value) {unset ($ array [$ I]);} print_r ($ array ); // Add another key $ array [] = 25; print_r ($ array); // use the array_values function to re-index $ array = array_values ($ array ); $ array [] = 13; print_r ($ array);?>