Answers for "php echo to console"

PHP
6

php console log

// Assuming you are wishing to log to the JS Console...

<?php
	function consoleLog($msg) {
		echo '<script type="text/javascript">' .
          'console.log(' . $msg . ');</script>';
	}

	consoleLog('Hello, console!');
?>
Posted by: Guest on March-07-2020
1

console.log in php

/*
console.log in php
*/

<?php
	function consoleLog($message) {
		echo '<script type="text/javascript">' .
          'console.log(' . $message . ');</script>';
	}

	consoleLog('Hello, greppers!');
?>
Posted by: Guest on May-11-2020
2

console php

//display message in console

<?php
	function console_log($msg) {
		echo '<script>' .
          'console.log("'.$msg .' ")</script>';
	}

	console_log("Hi there!");
?>
Posted by: Guest on October-06-2020
-1

php print to console

<script>
    console.log(<?= json_encode($foo); ?>);
</script>
Posted by: Guest on June-06-2020
0

php console print

$a = array(
 null => 'a',
 true => 'b',
 false => 'c',
 0 => 'd',
 1 => 'e',
 '' => 'f'
);

echo count($a), "\n";
Posted by: Guest on October-10-2020

Browse Popular Code Answers by Language