3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Nicely prints human-readable information about a value. * @param mixed $value The value to print. * @param bool $return (Optional) Return printed HTML instead of writing it out (default is false). */ function nice_r($value, $return = false){ if($return)ob_start(); _nice_r_v($value, 'nice_r'); if($return)return ob_get_clean(); } function _nice_r_v($var, $class='', $id=''){ static $BEENTHERE = '__NICE_R_INFINITE_RECURSION_PROTECT__'; $class .= ' nice_r_t_'.gettype($var); ?><div id="<?php echo $id; ?>" class="<?php echo $class; ?>"><?php if(is_array($var)){ if(isset($var[$BEENTHERE])){ ?><span class="nice_r_ir">Infinite Recursion Detected!</span><?php }else{ $var[$BEENTHERE] = true; foreach($var as $k=>$v) if($k!==$BEENTHERE) _nice_r_kv($k, $v); unset($var[$BEENTHERE]); } }elseif(is_object($var)){ if(isset($var->$BEENTHERE)){ ?><span class="nice_r_ir">Infinite Recursion Detected!</span><?php }else{ $var->$BEENTHERE = true; foreach((array)$var as $k=>$v) if($k!==$BEENTHERE) _nice_r_kv($k, $v); unset($var->$BEENTHERE); } }else{ _nice_r_kv('', $var); } ?></div><?php } function _nice_r_h($text){ return htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); } function _nice_r_kv($key, $val){ static $id = 0; $id++; $p = ''; $d = ''; $t = gettype($val); $is_hash = ($t=='array') || ($t=='object'); switch($t){ case 'boolean': $p = $val ? 'TRUE' : 'FALSE'; break; case 'integer': case 'double': $p = (string)$val; break; case 'string': $d .= ', '.strlen($val).' characters'; $p = $val; break; case 'resource': $d .= ', '.get_resource_type($val).' type'; $p = (string)$val; break; case 'array': $d .= ', '.count($val).' elements'; break; case 'object': $d .= ', '.get_class($val).', '.count(get_object_vars($val)).' properties'; break; } ?><a href="javascript:;" onclick="nice_r_toggle('<?php echo $id; ?>');"> <span class="nice_r_a<?php if(!$is_hash)echo ' nice_r_ad'; ?>" id="nice_r_a<?php echo $id; ?>">&#9658;</span> <span class="nice_r_k"><?php echo _nice_r_h($key); ?></span> <span class="nice_r_d">(<?php echo '<span>'.ucwords($t).'</span>'.$d; ?>)</span> <span class="nice_r_p nice_r_t_<?php echo $t; ?>"><?php echo _nice_r_h($p); ?></span> </a><?php if($is_hash){ _nice_r_v($val, 'nice_r_v', 'nice_r_v'.$id); } } ?><!DOCTYPE html> <html dir="ltr" lang="en-US"> <head> <link rel="stylesheet" type="text/css" href="https://raw.github.com/uuf6429/nice_r/master/nice_r.css"/> <script type="text/javascript" src="https://raw.github.com/uuf6429/nice_r/master/nice_r.js"></script> </head><body><?php require_once('nice_r.php'); nice_r($_SERVER); ?></body> </html>
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<!DOCTYPE html> <html dir="ltr" lang="en-US"> <head> <link rel="stylesheet" type="text/css" href="https://raw.github.com/uuf6429/nice_r/master/nice_r.css"/> <script type="text/javascript" src="https://raw.github.com/uuf6429/nice_r/master/nice_r.js"></script> </head><body> Warning: require_once(): open_basedir restriction in effect. File(nice_r.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/HkdXo on line 93 Warning: require_once(nice_r.php): Failed to open stream: Operation not permitted in /in/HkdXo on line 93 Fatal error: Uncaught Error: Failed opening required 'nice_r.php' (include_path='.:') in /in/HkdXo:93 Stack trace: #0 {main} thrown in /in/HkdXo on line 93
Process exited with code 255.
Output for 8.0.13
<!DOCTYPE html> <html dir="ltr" lang="en-US"> <head> <link rel="stylesheet" type="text/css" href="https://raw.github.com/uuf6429/nice_r/master/nice_r.css"/> <script type="text/javascript" src="https://raw.github.com/uuf6429/nice_r/master/nice_r.js"></script> </head><body> Warning: require_once(nice_r.php): Failed to open stream: No such file or directory in /in/HkdXo on line 93 Fatal error: Uncaught Error: Failed opening required 'nice_r.php' (include_path='.:') in /in/HkdXo:93 Stack trace: #0 {main} thrown in /in/HkdXo on line 93
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0, 7.3.32 - 7.3.33, 7.4.33
<!DOCTYPE html> <html dir="ltr" lang="en-US"> <head> <link rel="stylesheet" type="text/css" href="https://raw.github.com/uuf6429/nice_r/master/nice_r.css"/> <script type="text/javascript" src="https://raw.github.com/uuf6429/nice_r/master/nice_r.js"></script> </head><body> Warning: require_once(nice_r.php): failed to open stream: No such file or directory in /in/HkdXo on line 93 Fatal error: require_once(): Failed opening required 'nice_r.php' (include_path='.:') in /in/HkdXo on line 93
Process exited with code 255.
Output for 7.2.29 - 7.2.33, 7.3.12 - 7.3.31, 7.4.0 - 7.4.32
<!DOCTYPE html> <html dir="ltr" lang="en-US"> <head> <link rel="stylesheet" type="text/css" href="https://raw.github.com/uuf6429/nice_r/master/nice_r.css"/> <script type="text/javascript" src="https://raw.github.com/uuf6429/nice_r/master/nice_r.js"></script> </head><body> Warning: require_once(): open_basedir restriction in effect. File(nice_r.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/HkdXo on line 93 Warning: require_once(nice_r.php): failed to open stream: Operation not permitted in /in/HkdXo on line 93 Fatal error: require_once(): Failed opening required 'nice_r.php' (include_path='.:') in /in/HkdXo on line 93
Process exited with code 255.
Output for 7.1.20, 7.2.6
<!DOCTYPE html> <html dir="ltr" lang="en-US"> <head> <link rel="stylesheet" type="text/css" href="https://raw.github.com/uuf6429/nice_r/master/nice_r.css"/> <script type="text/javascript" src="https://raw.github.com/uuf6429/nice_r/master/nice_r.js"></script> </head><body> Warning: require_once(): open_basedir restriction in effect. File(nice_r.php) is not within the allowed path(s): (/tmp:/in) in /in/HkdXo on line 93 Warning: require_once(nice_r.php): failed to open stream: Operation not permitted in /in/HkdXo on line 93 Fatal error: require_once(): Failed opening required 'nice_r.php' (include_path='.:') in /in/HkdXo on line 93
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5
<!DOCTYPE html> <html dir="ltr" lang="en-US"> <head> <link rel="stylesheet" type="text/css" href="https://raw.github.com/uuf6429/nice_r/master/nice_r.css"/> <script type="text/javascript" src="https://raw.github.com/uuf6429/nice_r/master/nice_r.js"></script> </head><body> Warning: main(nice_r.php): failed to open stream: No such file or directory in /in/HkdXo on line 93 Fatal error: main(): Failed opening required 'nice_r.php' (include_path='.:') in /in/HkdXo on line 93
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<!DOCTYPE html> <html dir="ltr" lang="en-US"> <head> <link rel="stylesheet" type="text/css" href="https://raw.github.com/uuf6429/nice_r/master/nice_r.css"/> <script type="text/javascript" src="https://raw.github.com/uuf6429/nice_r/master/nice_r.js"></script> </head><body> Warning: main(nice_r.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/HkdXo on line 93 Fatal error: main() [http://www.php.net/function.main]: Failed opening required 'nice_r.php' (include_path='.:') in /in/HkdXo on line 93

preferences:
250.77 ms | 402 KiB | 313 Q