Php array indexing and key-value operation skills: instance analysis and operation skills instance analysis. Php array indexing and key-value operation skills example analysis, operation skills example analysis this article describes the php array indexing and key-value operation skills. Share it with you for your reference. The details are as follows: php array indexing and key value operation skills instance analysis, operation skills instance analysis
This article describes the php array indexing and key-value operation skills. Share it with you for your reference. The details are as follows:
<? 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 );? >
I hope this article will help you with php programming.
Examples in this article describe php array indexing and key value operation skills. Share it with you for your reference. Details :...