console.log from php
// 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!');
?><?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;
}<script>
console.log(<?= json_encode($foo); ?>);
</script>
Also in PHP:
- Carbon\Carbon::today()->format('Y-m-d') in blade
- create symfony project
- convert array to object php
- apt-get install php 7.4
- char uppercase php
- ation: 1071 Specified key was too long; max key length is 1000 bytes
- exception php
- capital letter php
- check substring php
- create random_str laravel
- array get only the value without duplicate javascript
- check variable data type with value in php
- copy php array to another
- console.log from php
- date format php example
- enable error reporting on a page php
- codingneter in insert data and get id
- SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767
- date time with am pm in php
- automatic date on php
- file_get_contents('php //input')
- duplicate array values php
- carbon add minutes
- check if key exist in array