0
$arr=array("1","3","4"); echo $arr[1]; through this we can print only one value of the array(wrt index).but,is there any way to print entire array at a time??
3 ответов
0
you can use array_values function that returns all the values from the ARRAY and indexes the array NUMERICALLY...
<?php
$array = array("size" => "XL" ,"color" => "gold");
print_r(array_values($array));
?>
OUTPUT IS:
Array
(
[0] => XL
[1] => gold
)
0
use the foreach loop
eg)
<?php
$arr=array("John","James","Peter");
foreach($arr as $value) {
echo $value."<br>";
}
?>
- 1
Just try echo$arr