Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I print all the values of an array? [closed]

I have an array and print_r won't display the raw text, how can I print all the values in an array (e.g. pie)

like image 937
John Doe Avatar asked Apr 03 '11 07:04

John Doe


2 Answers

So many ways to do it...

foreach ($array as $item) {
    echo $item;
}

echo join(', ', $array);

array_walk($array, create_function('$a', 'echo $a;'));
like image 189
deceze Avatar answered Sep 30 '22 13:09

deceze


<?php
$len=count($pie);
for ($i=0;$i<$len;$i++)
   echo $pie[$i];
?>
like image 39
Sourav Avatar answered Sep 30 '22 14:09

Sourav