Skip to content

Instantly share code, notes, and snippets.

@YurePereira
Created February 10, 2017 14:12
Show Gist options
  • Select an option

  • Save YurePereira/cfc7c74d1a8c2574e08db433809a04c0 to your computer and use it in GitHub Desktop.

Select an option

Save YurePereira/cfc7c74d1a8c2574e08db433809a04c0 to your computer and use it in GitHub Desktop.
Criando Array multidimensional no PHP
<?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