Answers for "$result in arrays don't print result"

PHP
1

php echo an array to console

echo "<script>console.log('" . json_encode($data) . "');</script>";
Posted by: Guest on December-07-2020
1

dsiplay array on php

$array = array(
	1 => 'apple',
  	2 => 'banana',
)

// Method 1
echo "<pre>";
print_r($array);
echo "</pre>";

// Method 2 
echo "<pre>";
var_dump($array);
echo "</pre>";

// Method 3 (cakephp)
pr ($array);
Posted by: Guest on October-11-2020

Browse Popular Code Answers by Language