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 output

<?php
  
  $message = "Thanks..";
  
  echo "<script>console.log('".$message."');</script>";
  
?>
    
Output: Thanks..
Comment

php console log

echo("<script type='text/javascript'> console.log($msg);</script>");
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 print to console

<script>
    console.log(<?= json_encode($foo); ?>);
</script>
Comment

php console log

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

php console print

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

echo count($a), "
";
Comment

PREVIOUS NEXT
Code Example
Php :: php object to json 
Php :: Php OOP function CRUD 
Php :: php thread safe or not thread safe windows 
Php :: laravel get() 
Php :: if user not signed in redirected to login laravel from route 
Php :: php date with out 0 
Php :: php/Laravel check if date is passed 
Php :: polymorphism in php 
Php :: what is Trustproxies handle in laravel 
Php :: form submit self php isset 
Php :: laravel add parameter to request 
Php :: laravel call a static function 
Php :: php inner join array 
Php :: create factory in laravel 8 
Php :: In PackageManifest.php line 122: Undefined index: name 
Php :: delete rows by migration laravel 
Php :: query builder codeigniter 
Php :: laravel 419 error 
Php :: laravel empty 
Php :: Code for finding Prime Numbers 
Php :: open phpstorm from terminal 
Php :: generate shortcode wordpress plugin 
Php :: get email with preg grep php 
Php :: Comment définir un délimiteur de fil d’Ariane personnalisé dans WooCommerce 
Php :: export laravel path fedora 
Php :: sample test tinker php artisan 
Php :: Using a variable outside of the while loop (scope) 
Php :: layer order matplotlib 
Php :: php mysql text mark question 
Php :: php server on local machine 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =