Arrays in PHP

 Arrays in PHP


Arrays are used to store multiple values in a single variable. PHP supports different types of arrays such as indexed arrays, associative arrays, and multidimensional arrays.

Example:


php


$fruits = array("apple", "banana", "orange");


echo $fruits[0]; // apple


$marks = array("John"=>80, "Mary"=>75, "Peter"=>85);


echo $marks["John"]; // 80

No comments:

Post a Comment

The Importance of Cybersecurity in the Digital Age

 The Importance of Cybersecurity in the Digital Age Introduction: In today's digital age, where technology is deeply intertwined with ev...