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 | |
| $myNumericArray = array(11, 232, 43, 45, 10); | |
| echo count($myNumericArray);//Print: 5 |
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 | |
| $myArray = array(11, array(10, 22, 34, 5), 43, 45, 10); | |
| echo count($myArray) . PHP_EOL;//Output: 5 | |
| echo count($myArray, 1);//Output: 9 |
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 | |
| $myArray = array( | |
| 'nome' => 'João', | |
| 'sobrenome' => 'Carlos', | |
| 'idade' => 30, | |
| 'telefone' => '3345-4233', | |
| 1.10 => '1',//índice com Float | |
| ); |
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 | |
| $myArray = array( | |
| 'nome' => 'João', | |
| 'sobrenome' => 'Carlos', | |
| 'idade' => 30, | |
| 'telefone' => '3345-4233' | |
| ); | |
| echo 'My name is ' . $myArray['nome'] . ' ' . $myArray['sobrenome']; |
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 | |
| $myArray = array( | |
| 'nome' => 'João', | |
| 100, | |
| 'sobrenome' => 'Carlos', | |
| 'idade' => 30, | |
| 'telefone' => '3345-4233', | |
| 9 | |
| ); |
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 | |
| $myArray = array(); | |
| print_r($myArray); |
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 | |
| $myArray = array( | |
| 'chave1' => 'valor1', | |
| 'chave2' => 'valor2', | |
| 'chave3' => 'valor3', | |
| 'chave4' => 'valor4', | |
| 'valor5', | |
| 'valor6', | |
| ); |
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 | |
| $myArray = [ | |
| 'chave1' => 'valor1', | |
| 'chave2' => 'valor2', | |
| 'valor3', | |
| 'valor4', | |
| ]; | |
| print_r($myArray); |
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', | |
| ), |
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( | |
| 'numericArray' => array( | |
| 'Item 1' | |
| ), | |
| 'associativeArray' => array( | |
| 'chave1' => 'valor1', | |
| ), |