welcome to tutorialfamily

php indexed array

PHP Indexed Arrays – used to assign multiple value in single variable.


PHP Indexed Arrays

Indexed start with always zero value.

Indexed array os automatically start.

We can assign index manually too.


PHP Indexed Arrays



<!DOCTYPE html>
<html>
<head>
	<title>PHP Indexed Arrays</title>
</head>
<body>
// PHP Indexed Arrays automatically<br>
<?php
	$cars = array("Volvo", "BMW", "Toyota");
	echo "My favourite car is " . $cars[0] . ", " . $cars[1] . ", " . $cars[2] . ".";
?>	<br>
// PHP Indexed Arrays manually<br>
<?php
	$cars[0] = "Volvo";
	$cars[1] = "BMW";
	$cars[2] = "Toyota";
	echo "My favourite car is " . $cars[0] . ", " . $cars[1] . ", " . $cars[2] . ".";
?>					
</body>
</html>

output

Our Content