Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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!');
?>
Comment

php console log

echo("<script type='text/javascript'> console.log($msg);</script>");
Comment

console php

//display message in console

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

	console_log("Hi there!");
?>
Comment

console log in php

<?php 
function console_log($object){
    echo "<script>console.log(".json_encode(var_export($object, true)).");</script>";
}
console_log('wow!');

?>
Comment

php console log

// A little correction / improvement to @Kaotik's answer:
<?php
	function consoleLog($msg)
	{
		echo '<script type="text/javascript">console.log('
          . str_replace('<', 'x3C', json_encode($msg))
          . ');</script>';
	}

	consoleLog('Hello, console!');
?>
Comment

php console log

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

PREVIOUS NEXT
Code Example
Php :: PHP Deprecated: Function create_function() 
Php :: carbon to mysql datetime 
Php :: how count the rout in route.php laravel 
Php :: Remove all attributes from HTML tags in PHP 
Php :: php add one day to date 
Php :: wordpress get user id by email 
Php :: laravel middleware check if user is logged in 
Php :: Too Many Attempts. laravel error 
Php :: run python script from batch file with arguments 
Php :: laravel print query with parameters 
Php :: Laravel Validation check array size min and max 
Php :: get field acf 
Php :: php artisan down 
Php :: count() parameter must be an array or an object that implements countable laravel 
Php :: laravel url previous 
Php :: php keep only letters and numbers 
Php :: factorial program in php using recursive function 
Php :: CodeIgniter get_where order_by 
Php :: use class Auth larave3l 
Php :: php array_reverse keep keys 
Php :: How to fix MySql: index column size too large (Laravel migrate) 
Php :: PHP Max Input Vars 
Php :: curl header log php 
Php :: how to get random element from a given array via php faker in laravel 
Php :: codeigniter store session data 
Php :: count number of rows laravel controller 
Php :: php 8 attributes 
Php :: increase memory laravel controller 
Php :: eloquent get distinct 
Php :: invalid datetime format 1292 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =