programming-examples/php/Arrays/PHP script to print second and Red from the following array.php

7 lines
289 B
PHP
Raw Normal View History

2019-11-15 12:59:38 +01:00
<?php
$color = array ( "color" => array ( "a" => "Red", "b" => "Green", "c" => "White"),
"numbers" => array ( 1, 2, 3, 4, 5, 6 ),
"holes" => array ( "First", 5 => "Second", "Third"));
echo $color["holes"][5]."\n"; // prints "second"
echo $color["color"]["a"]."\n"; // prints "Red"
?>