PHP Associative ArrayPHP allows you to associate name/label with each array elements in PHP using => symbol. Such way, you can easily remember the element because each element is represented by label than an incremented number. DefinitionThere are two ways to define associative array: 1st way: 2nd way: ExampleFile: arrayassociative1.phpOutput: Sonoo salary: 550000 Vimal salary: 250000 Ratan salary: 200000 Output: Sonoo salary: 550000 Vimal salary: 250000 Ratan salary: 200000 Traversing PHP Associative ArrayBy the help of PHP for each loop, we can easily traverse the elements of PHP associative array. Output: Key: Sonoo Value: 550000 Key: Vimal Value: 250000 Key: Ratan Value: 200000
Next TopicPHP Multidimensional Array
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week