The ‘=>’ symbol is used to assign key value pairs in an array. The value of left side is called key and the value of right side is called value of key. It is mostly used in associative array.
key => value
Example 1: PHP program to create associative array using ‘=>’ symbol.
Marks for students: Maths:95 Physics:90 Chemistry:96 English:93 Computer:98
Example 2: PHP program to create numeric indexed array using ‘=>’ symbols.
0 => 7 1 => 10 2 => 8 3 => 5
Example 3: PHP program to assign numeric index without using ‘=>’ symbol.
0 => Zack 1 => Anthony 2 => Ram 3 => Salim 4 => Raghav
- What is the use of the @ symbol in PHP?
- Multi-threaded programming in Python
- Introduction of Graduate Record Examinations (GRE)
- egrep command in Linnux with examples
- How to select all child elements recursively using CSS?
- HTML | DOM Input Image Object
- HTML | DOM Ol start Property
- HTML | DOM Option disabled Property
- PHP | filter_has_var() function
- HTML | DOM KeyboardEvent keyCode Property
- HTML | DOM InputEvent
- HTML | DOM Parameter Object
- PHP | headers_sent() function
- HTML | DOM Link Object