Answers for "php display array value"

PHP
0

php print array

// raw array output
print_r($arr);

// the above well-formatted
echo '<pre>'; print_r($array); echo '</pre>';

// more details like datatype and length
var_dump($arr);

// output that PHP understands
var_export($arr);

// by foreach loop
foreach($arr as $key=>$value)
  echo $key, '=>', $value;	// $value must be convertible to string
Posted by: Guest on February-17-2021
1

php echo array

foreach($results as $result) {
	echo $result . '<br>';
}
Posted by: Guest on April-02-2020
0

print array items in php

<?php $data = array('a'=>'apple','b'=>'banana','c'=>'orange');?>
<pre><?php print_r($data); ?></pre>
Posted by: Guest on July-15-2021
2

php echo array

$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
print_r ($a);
Posted by: Guest on October-08-2020

Browse Popular Code Answers by Language