Copy code The code is as follows:
$array = array("key1" => "Simon" , 2 => "Elaine"); //Creation of array
echo $array["key1"]; //Output Simon
echo $array[2]; //Output Elaine
?> ;
Copy code The code is as follows:
$ array = array("key1" => array(0 => 1, 1 => 10, 2 => 100),
"key2" => array(0 => 5, 1 = > 25, 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 code The code is as follows:
$array = array("key1" => array(0 => 1, 1 => 10, 2 => 100), //Define array
"key2" => array(0 => 5, 1 => 25, 2 => 125));
print_r($array); //Output array
?>
Copy code The code is as follows:
$array = array("a", "b","c"); //Define array
print_r($array); //Output array
?>
Copy code The code is as follows:
$array = array("a", "b","c"); //Define array
$array[0] = "Simon"; //Modify array elements
print_r($array ); //Output array
?>
http://www.bkjia.com/PHPjc/319944.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319944.htmlTechArticleCopy the code as follows: ?php $array = array("key1" = "Simon", 2 = "Elaine "); //Creation of array echo $array["key1"]; //Output Simon echo $array[2]; //Output Elaine? Copy code...