echo to console 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!');
?>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:
- $date < $date php
- check the value type in php
- csv to json php
- Fatal error: Allowed memory size of 1073741824 bytes exhausted (trie
- : Allowed memory size of 268435456 bytes exhausted (tried to allocate 77155656 bytes) in /home/gergstor/public_html/seo/application/third_party/MX/Loader.php on line 373 A PHP Error was encountered Severity: Error Message: Allowed memory size of
- clear file cache laravel
- cache clear command in larvel
- corsair k70 rgb mk.2
- convert stdclass object to array php
- console.log php variables
- $result->result()
- clear laravel cache manually
- console.log from php
- dateformat j/m/a php
- Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/Users/USER/composer/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223
- artisan migrate one table
- change the format of date c#
- base64 to image
- clear laravel response cache
- Basic features of Exception Handling php
- char to uppercase php
- dump all variables twig
- aadd day in date php
- cache delete or forget in laravel