php echo an array to console code example Example: php echo an array to console echo "<script>console.log('" . json_encode($data) . "');</script>";