Revision: 74333
Updated Code
at October 9, 2019 19:22 by cerxx
Updated Code
function console_log() { static $f = false; if (!func_num_args()) return; # Argumenty` ne peredany` if (!$f) $f = fopen('!console.log',"w"); foreach (func_get_args() as $arg) { if (is_bool($arg)) $s = $arg?'TRUE':'FALSE'; elseif (is_array($arg) or is_object($arg)) $s = print_r($arg, TRUE); else $s = $arg; fwrite($f,$s.' '); # vy`vod argumentov razdeliaetsia probelom } } //Primer ispol`zovaniia # skript vy`polniaetsia, peremenny`e sozdaiutsia $a = array('name'=>'PHP debagger console_log()', 'txt'=>'Primer ispol`zovaniia'); $b = isset($a); # ?.?. TRUE $c = time(); # a teper` uznaem, kak u nas dela console_log('$a',$a,'$b',$b,'? ??? $c',$c); // ========= Variant 2 ============= public function _console_log(){ date_default_timezone_set ("Europe/Kiev"); static $f = false; if (!func_num_args()) return; # Argumenty` ne peredany` if (!$f) $f = fopen('!console.log',"w"); foreach (func_get_args() as $arg) { if (is_bool($arg)) $s = $arg?'TRUE':'FALSE'; elseif (is_array($arg) or is_object($arg)) $s = print_r($arg, TRUE); else $s = $arg; $c = date("Y.m.d H:i:s"); fwrite($f,$c . " ". $s.PHP_EOL); } }
Revision: 74332
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 30, 2018 06:05 by cerxx
Initial Code
function console_log() { static $f = false; if (!func_num_args()) return; # Argumenty` ne peredany` if (!$f) $f = fopen('!console.log',"w"); foreach (func_get_args() as $arg) { if (is_bool($arg)) $s = $arg?'TRUE':'FALSE'; elseif (is_array($arg) or is_object($arg)) $s = print_r($arg, TRUE); else $s = $arg; fwrite($f,$s.' '); # vy`vod argumentov razdeliaetsia probelom } } //Primer ispol`zovaniia # skript vy`polniaetsia, peremenny`e sozdaiutsia $a = array('name'=>'PHP debagger console_log()', 'txt'=>'Primer ispol`zovaniia'); $b = isset($a); # ?.?. TRUE $c = time(); # a teper` uznaem, kak u nas dela console_log('$a',$a,'$b',$b,'? ??? $c',$c);
Initial URL
http://pavluha.net/php-analog-funktsii-console-log.html
Initial Description
Debugger analog for PHP: debugger console_log ().
Initial Title
PHP analog of console.log () function
Initial Tags
debug
Initial Language
PHP