How to define a two-dimensional array in php

藏色散人
Release: 2023-02-25 20:44:01
Original
16413 people have browsed it

How to define a two-dimensional array in php

How to define a two-dimensional array in php?

The values ​​in one array can be another array, and the values ​​in another array can also be an array. In this way, we can create a two-dimensional or three-dimensional array:

The code example is as follows:

Copy after login

Output:

Array
(
    [0] => Array
        (
            [0] => Volvo
            [1] => 100
            [2] => 96
        )

    [1] => Array
        (
            [0] => BMW
            [1] => 60
            [2] => 59
        )

    [2] => Array
        (
            [0] => Toyota
            [1] => 110
            [2] => 100
        )

)
Copy after login

For more PHP knowledge, please visit PHP中文网!

The above is the detailed content of How to define a two-dimensional array in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!