chrome dev tools php console log
<script>
console.log(<?= json_encode($foo); ?>);
</script>/*
console.log in php
*/
<?php
function consoleLog($message) {
echo '<script type="text/javascript">' .
'console.log(' . $message . ');</script>';
}
consoleLog('Hello, greppers!');
?>function debug($var, $die = false, $trace = true, $show_from = true)
{
//Trick to avoid html corruptions
echo '</select>';
echo '</script>';
// BackTrace
$stack = '';
$i = 1;
$trace = debug_backtrace();
array_shift($trace);
foreach ($trace as $node) {
if (isset($node['file']) && ($node['line'])) {
$stack .= "#$i " . $node['file'] . "(" . $node['line'] . "): ";
}
if (isset($node['class'])) {
$stack .= $node['class'] . "->";
}
$stack .= $node['function'] . "()" . PHP_EOL;
$i++;
}
$out[] = '<pre style="background-color:#CCCCCC">';
if ($show_from) {
$calledFrom = debug_backtrace();
$out[] = '<strong>' . substr(str_replace(dirname(__FILE__), '', $calledFrom[0]['file']), 1) . '</strong>';
$out[] = ' (line <strong>' . $calledFrom[0]['line'] . '</strong>)';
}
$out[] = htmlspecialchars(print_r($var, true));
if (is_object($var)) {
$out[] = '-------- Class methods --------';
$out[] = print_r(get_class_methods(get_class($var)), true);
}
if ($trace) {
$out[] = '-------- Backtrace --------';
$out[] = $stack;
}
$out[] = '</pre>';
echo implode(PHP_EOL, $out);
if ($die) {
die();
}
break;
}
Also in PHP:
- clear laravel 5 cache\
- combine two query value in laravel 8
- composer laravel install
- current time in php
- check for a word in a string php
- date fonction php
- php timestamp to date
- codeigniter last id inserted
- check if string includes substring php
- cache flush laravel
- How to Delete Multiple Records using Checkbox in Laravel
- Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/service.ramondettiforwarding.com/lib/vendor/guzzlehttp/guzzle/src/Middleware.php on line 3432184904
- click confirm before submit form php
- check if array has value php
- In Connection.php line 1262: Class 'PDO' not found
- css date function
- connexion à la base de donnée microsoftsqlserver avec php
- codeigniter validation text length
- array uniuq in php
- error uncaught even in try catch php
- .length - 5 in php
- echo json php
- check that php array has specific key
- - phpunit/phpunit 8.5.x-dev requires ext-dom * -> the requested PHP extension dom is missing from your system.