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.log in php

/*
console.log in php
*/

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

	consoleLog('Hello, greppers!');
?>
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

console.log for php

<?php
function console_log($output, $with_script_tags = true)
{
    $js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) . ');';
    if ($with_script_tags)
    {
        $js_code = '<script>' . $js_code . '</script>';
    }
    echo $js_code;
}

#Let's use this :) 

$name = "Omar Faruk"; // string type variable

console_log($name); // "Omar Faruk"
console_log(gettype($name)); // string


// now go to the browser and check the console 
Comment

console_log in php

<?php
function console_log($output, $with_script_tags = true) {
    $js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) . 
');';
    if ($with_script_tags) {
        $js_code = '<script>' . $js_code . '</script>';
    }
    echo $js_code;
}
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 :: eloquent firstorcreate 
Php :: laravel websockets 
Php :: get month days in php 
Php :: + php quantifer 
Php :: PHP code to read JSON string on server 
Php :: laravel blade excerpt from body 
Php :: php multiplei str 
Php :: carbon now set timezone 
Php :: if post checked category wordpress 
Php :: check email veriy or not laravel 
Php :: php is_assoc 
Php :: mysql between all months days even null 
Php :: Update Custom Cart Count (or any HTML) after AJAX Add to Cart in WooCommerce 
Php :: mysqli connect error 
Php :: hasmany relationship in laravel 
Php :: Unable to do sum and getting same value by using while loop php 
Php :: phpmyadmin mysql execution time 
Php :: how to remove last element from php array 
Php :: encapsulation in php 
Php :: create a button add in laravel 
Php :: expose loading laravel 
Php :: Update Data Multiple Columns MySql Database Table PHP Function 
Php :: cakephp sql query 
Php :: PHP multidimensional array merge recursive 
Php :: php monolog 
Php :: optional parameter in laravel 
Php :: yajra datatables html column bulder example 
Php :: The last ship -inurl:(htm/html/php/pls/txt) intitle:index.of "last modified" (mp4/wma/aac/avi) 
Php :: model not found laravel 
Php :: php inner join array 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =