Answers for "php print array"

PHP
12

print array php

<?php
$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
echo "<pre>";
print_r ($a);
echo "</pre>";
?>
  
Output:

Array
(
    [a] => apple
    [b] => banana
    [c] => Array
        (
            [0] => x
            [1] => y
            [2] => z
        )
)
Posted by: Guest on February-26-2020
1

php echo array

function echo_arr($arr){
        for ($i=0; $i < count($arr); $i++) { 
                echo $arr[$i];
            }
        }

echo_arr($your_array_here);
Posted by: Guest on June-29-2021
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
2

php echo array

<?php
$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
print_r ($a);
?>
Posted by: Guest on April-02-2020
3

print array on php

foreach($results['data'] as $result) {
    echo $result['type'], '<br>';
}
Posted by: Guest on July-27-2020
1

php echo array

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

Browse Popular Code Answers by Language