Copy CodeThe code is as follows:
$array = Array ("Key1" = "Simon", 2 = "Elaine"); Creation of arrays
echo $array ["Key1"]; Output Simon
Echo $array [2]; Output Elaine
?>
Copy the Code code as follows:
$array = Array ("key1" = = Array (0 = 1, 1 =, 2 = 100),
"Key2" = = Array (0 = 5, 1 =, 2 = 125));
echo $array ["Key1"][0]; Output 1
echo $array ["Key1"][1]; Output 10
echo $array ["Key1"][2]; Output 100
echo $array ["Key2"][0]; Output 5
echo $array ["Key2"][1]; Output 25
echo $array ["Key2"][2]; Output 125
?>
Copy the Code code as follows:
$array = Array ("key1" = = Array (0 = 1, 1 =, 2 = 100),//define Array
"Key2" = = Array (0 = 5, 1 =, 2 = 125));
Print_r ($array); Output array
?>
Copy the Code code as follows:
$array = Array ("A", "B", "C"); Defining arrays
Print_r ($array); Output array
?>
Copy the Code code as follows:
$array = Array ("A", "B", "C"); Defining arrays
$array [0] = "Simon"; Modifying an array element
Print_r ($array); Output array
?>
The above describes the realization of the ideal idiom PHP array creation, invocation and update implementation code, including the realization of the ideal idiom aspect of the content, I hope the PHP tutorial interested in a friend helpful.