小池有话说

Quick and dirty php functions

2018-09-13

json decode on the fly

php -r "print_r(json_decode(file_get_contents('php://stdin')));"

debug online

function d($str,$data=null){
    $file = "/tmp/php_debug_".date('Ymd').".log";
    error_log(sprintf("[%s] %s %s\n",date('c'),$str,json_encode($data,JSON_UNESCAPED_UNICODE)), 3, $file);
}