Associative Arrays (why "=>" instead of just "=" ) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Associative Arrays (why "=>" instead of just "=" )

While learning this topic "Associative Arrays" in PHP, I am not able to understand, why => is used instead of simply assigning like = i.e what I mean to say is , instead of "David"=>"27" , we can assign "David"="27". Please help me. The reference code is given below: $people = array("David"=>"27", "Amy"=>"21", "John"=>"42");

25th Jun 2019, 11:36 AM
mohan borkar
mohan borkar - avatar
1 Answer
+ 1
It's just how it is, besides, using equal signs would be a bad idea, because it would confuse declaration
25th Jun 2019, 11:37 AM
Airree
Airree - avatar