Php Array To Console

[Solved] Php Array To Console | Php - Code Explorer | yomemimo.com
Question : php array to console

Answered by : vastemonde

function console_log( $data ){ echo '<script>'; echo 'console.log('. json_encode( $data ) .')'; echo '</script>';
}
Usage:
$myvar = array(1,2,3);
console_log( $myvar ); // [1,2,3]

Source : | Last Update : Sat, 20 Mar 21

Question : php echo an array to console

Answered by : different-dormouse-b44ls1p2vb3t

echo "<script>console.log('" . json_encode($data) . "');</script>";

Source : | Last Update : Mon, 14 Dec 20

Answers related to php array to console

Code Explorer Popular Question For Php