Created
June 7, 2018 07:49
-
-
Save niravmadariya/ef0bc83efcdf841bd5d4f0efeb93bb06 to your computer and use it in GitHub Desktop.
Numerical and Associative Array Example in 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 | |
| $a[0] = 1; // Numeric Array | |
| $a[1] = 2; | |
| $a[2] = 3; | |
| $a[3] = 4; | |
| $a[4] = 5; | |
| $b['a']='a'; // Associative Array | |
| $b['b']='b'; | |
| $b['c']='c'; | |
| $b['d']='d'; | |
| $b['e']='e'; | |
| foreach($a as $aa){ | |
| echo $aa; | |
| } | |
| foreach($b as $key => $value){ | |
| echo $key." : ".$value; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment