03- array of array

03- array of array

https://rextester.com/QNYQ53194
<?php //php 7.0.8

$array0=array();
$array1=array("Orange" => 100, "Apple" => 200, "Banana" => 300, "Cherry" => 400);
    print_r($array1["Orange"]);

$foo = [];
    $t1=array(
        'url' => '',
        'name' => 'fooValue2'
    );
    array_push($foo,$t1 );
    array_push($foo,$t1 );
$data=array('directories' => $foo);
    
    print_r($data);
    print_r($data['directories']);
    print_r($data['directories'][0]);
    print_r($data['directories'][0]['name']);

?>

]
輸出:

100Array
(
    [directories] => Array
        (
            [0] => Array
                (
                    [url] => 
                    [name] => fooValue2
                )

            [1] => Array
                (
                    [url] => 
                    [name] => fooValue2
                )

        )

)
Array
(
    [0] => Array
        (
            [url] => 
            [name] => fooValue2
        )

    [1] => Array
        (
            [url] => 
            [name] => fooValue2
        )

)
Array
(
    [url] => 
    [name] => fooValue2
)
fooValue2

PHP
01 StringCH02 Array技術文章CodeIgniter 技術文章youtube api 技術文章新浪微博开放平台