php Array
PHP Array
1] PHP Array is variable can store only one values
2] And array is use to store multiple value of a same data type.
3] To create an array we used [ ] square bracket.
4] By Default first element in and array store at Index No "0".
5] To access value in an array pass index No in square bracket.
PHP ARRAY TYPES :-
1] Indexed Array
2] Associative Array
3] Multidimension Array
PHP Array
Example :-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> array </title>
</head>
<body>
<?php
$student= array("vitthal","seeta", "ram","shyam","radha","rukmini","krishna");
var_dump($student);
?>
</body>
</html>
PHP Array
Output :-
PHP Array
Example :-
Q calculate length of array that is number array element.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>array</title>
</head>
<body>
<?php
$student=["vitthal","radha","seeta","ram"];
$length=count($student);
echo "No of array element=".$length;
?>
</body>
</html>
PHP Array
Output :-
No of array element=4
Post a Comment