Change language

What is the use of the “= & gt;” in PHP?

Syntax:
key = > value 
Example 1:PHP program to create an associative array using the "= >" character.
// PHP program to use the symbol ’ = > ’ $subject = array ( "Maths" = > 95, " Physics " = > 90, " Chemistry " = > 96, "English" = > 93, " Computer " = > 98 );  
// Accessing array elements echo "Marks for students:" ; echo "Maths:" . $subject [ "Maths" ], "" ; echo "Physics:" . $subject [ "Physics" ], "" ; echo "Chemistry:" . $subject [ "Chemistry" ], "" ; echo "English:" . $subject [ "English" ], "" ; echo "Computer:" . $subject [ "Computer" ], "" ;  
?>
Exit:
Marks for students : Maths: 95 Physics: 90 Chemistry: 96 English: 93 Computer: 98 
Example 2:PHP program to create a numeric indexed array using the "= >" characters.
// PHP program for creating numeric
// indexed array $arr = array ( "0" = > 7, " 1 " = > 10, "2" = > 8, "3" = > 5 );  
// Show array elements foreach ( $arr as $key = > $value ) { echo $key . "= >" . $value . "" ; }  
?>
Exit:
0 = > 7 1 = > 10 2 = > 8 3 = > 5 
Example 3:PHP program to assign a numeric index without using the ’ = & amp; gt & # 39 ;.
// PHP program for creating indexed array
// without using symbols ’ = > ’ $name = array ( "Zack" , "Anthony" , "Ram" , "Salim" , "Raghav" );  
// Show array elements foreach ( $name as $key = > $value ) { echo $key . "= >" . $value . "" ; }  
?>
Exit:
0 = > Zack 1 = > Anthony 2 = > Ram 3 = > Salim 4 = > Raghav 

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method