Created
February 10, 2017 14:12
-
-
Save YurePereira/cfc7c74d1a8c2574e08db433809a04c0 to your computer and use it in GitHub Desktop.
Criando Array multidimensional no PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //Array principal sendo a primeira dimensão. | |
| $multidimensionalArray = array( | |
| //Array numérico sendo a segunda dimensão. | |
| 'numericArray' => array( | |
| 'Item 1', | |
| 'Item 2', | |
| 'Item 3', | |
| ), | |
| //Array associativo sendo a segunda dimensão. | |
| 'associativeArray' => array( | |
| 'chave1' => 'valor1', | |
| 'chave2' => 'valor2', | |
| 'chave3' => 'valor3', | |
| ), | |
| //Array Associativo sendo a segunda dimensão. | |
| 'sub_array_1' => array( | |
| //Array numérico sendo a terceira dimensão. | |
| 'sub_array_2' => array( | |
| 'Item 1', | |
| 'Item 2', | |
| ) | |
| ) | |
| ); | |
| print_r($multidimensionalArray); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment