Follow on Facebook

header ads

Array in php


Array in php


In this tutorial, i will show you how to define array in php. as you know array is a homogeneous type of data which contain same type of data at time. after assigning data to array by using print_r and echo function display its data on screen.



<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>array in php</title>
</head>
<body>
<?php
$var = array("ali","asif","asad");// array is a homogenous type of data because same type of data is stored in an array.
print_r($var);//output shows each index and its stored values.

echo "<br/>".$var[0]; // for display through echo function index number is providing by square brackets.
?>
</body>
</html>




Post a Comment

0 Comments