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>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HkdXo
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   86     0  E >   ECHO                                                     '%3C%21DOCTYPE+html%3E%0A%3Chtml+dir%3D%22ltr%22+lang%3D%22en-US%22%3E%0A++++%3Chead%3E%0A++++++++%3Clink+rel%3D%22stylesheet%22+type%3D%22text%2Fcss%22+href%3D%22https%3A%2F%2Fraw.github.com%2Fuuf6429%2Fnice_r%2Fmaster%2Fnice_r.css%22%2F%3E%0A++++++++%3Cscript+type%3D%22text%2Fjavascript%22+src%3D%22https%3A%2F%2Fraw.github.com%2Fuuf6429%2Fnice_r%2Fmaster%2Fnice_r.js%22%3E%3C%2Fscript%3E%0A++++%3C%2Fhead%3E%3Cbody%3E'
   93     1        INCLUDE_OR_EVAL                                          'nice_r.php', REQUIRE_ONCE
   95     2        INIT_FCALL                                               'nice_r'
          3        FETCH_R                      global              ~1      '_SERVER'
          4        SEND_VAL                                                 ~1
          5        DO_FCALL                                      0          
   97     6        ECHO                                                     '%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   98     7      > RETURN                                                   1

Function nice_r:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/HkdXo
function name:  nice_r
number of ops:  14
compiled vars:  !0 = $value, !1 = $return
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    9     2      > JMPZ                                                     !1, ->5
          3    >   INIT_FCALL                                               'ob_start'
          4        DO_ICALL                                                 
   10     5    >   INIT_FCALL_BY_NAME                                       '_nice_r_v'
          6        SEND_VAR_EX                                              !0
          7        SEND_VAL_EX                                              'nice_r'
          8        DO_FCALL                                      0          
   11     9      > JMPZ                                                     !1, ->13
         10    >   INIT_FCALL                                               'ob_get_clean'
         11        DO_ICALL                                         $4      
         12      > RETURN                                                   $4
   12    13    > > RETURN                                                   null

End of function nice_r

Function _nice_r_v:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 33
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 30
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 30
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 29
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
Branch analysis from position: 30
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 55
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
Branch analysis from position: 39
2 jumps found. (Code = 77) Position 1 = 43, Position 2 = 52
Branch analysis from position: 43
2 jumps found. (Code = 78) Position 1 = 44, Position 2 = 52
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 51
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 51
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
Branch analysis from position: 52
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HkdXo
function name:  _nice_r_v
number of ops:  61
compiled vars:  !0 = $var, !1 = $class, !2 = $id, !3 = $BEENTHERE, !4 = $v, !5 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
          2        RECV_INIT                                        !2      ''
   15     3        BIND_STATIC                                              !3
   16     4        GET_TYPE                                         ~6      !0
          5        CONCAT                                           ~7      '+nice_r_t_', ~6
          6        ASSIGN_OP                                     8          !1, ~7
   17     7        ECHO                                                     '%3Cdiv+id%3D%22'
          8        ECHO                                                     !2
          9        ECHO                                                     '%22+class%3D%22'
         10        ECHO                                                     !1
         11        ECHO                                                     '%22%3E'
   18    12        TYPE_CHECK                                  128          !0
         13      > JMPZ                                                     ~9, ->33
   19    14    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !3
         15      > JMPZ                                                     ~10, ->18
   20    16    >   ECHO                                                     '%3Cspan+class%3D%22nice_r_ir%22%3EInfinite+Recursion+Detected%21%3C%2Fspan%3E'
         17      > JMP                                                      ->32
   22    18    >   ASSIGN_DIM                                               !0, !3
         19        OP_DATA                                                  <true>
   23    20      > FE_RESET_R                                       $12     !0, ->30
         21    > > FE_FETCH_R                                       ~13     $12, !4, ->30
         22    >   ASSIGN                                                   !5, ~13
   24    23        IS_NOT_IDENTICAL                                         !5, !3
         24      > JMPZ                                                     ~15, ->29
   25    25    >   INIT_FCALL_BY_NAME                                       '_nice_r_kv'
         26        SEND_VAR_EX                                              !5
         27        SEND_VAR_EX                                              !4
         28        DO_FCALL                                      0          
   23    29    > > JMP                                                      ->21
         30    >   FE_FREE                                                  $12
   26    31        UNSET_DIM                                                !0, !3
         32    > > JMP                                                      ->59
   28    33    >   TYPE_CHECK                                  256          !0
         34      > JMPZ                                                     ~17, ->55
   29    35    >   ISSET_ISEMPTY_PROP_OBJ                                   !0, !3
         36      > JMPZ                                                     ~18, ->39
   30    37    >   ECHO                                                     '%3Cspan+class%3D%22nice_r_ir%22%3EInfinite+Recursion+Detected%21%3C%2Fspan%3E'
         38      > JMP                                                      ->54
   32    39    >   ASSIGN_OBJ                                               !0, !3
         40        OP_DATA                                                  <true>
   33    41        CAST                                          7  ~20     !0
         42      > FE_RESET_R                                       $21     ~20, ->52
         43    > > FE_FETCH_R                                       ~22     $21, !4, ->52
         44    >   ASSIGN                                                   !5, ~22
   34    45        IS_NOT_IDENTICAL                                         !5, !3
         46      > JMPZ                                                     ~24, ->51
   35    47    >   INIT_FCALL_BY_NAME                                       '_nice_r_kv'
         48        SEND_VAR_EX                                              !5
         49        SEND_VAR_EX                                              !4
         50        DO_FCALL                                      0          
   33    51    > > JMP                                                      ->43
         52    >   FE_FREE                                                  $21
   36    53        UNSET_OBJ                                                !0, !3
         54    > > JMP                                                      ->59
   39    55    >   INIT_FCALL_BY_NAME                                       '_nice_r_kv'
         56        SEND_VAL_EX                                              ''
         57        SEND_VAR_EX                                              !0
         58        DO_FCALL                                      0          
   41    59    >   ECHO                                                     '%3C%2Fdiv%3E'
   42    60      > RETURN                                                   null

End of function _nice_r_v

Function _nice_r_h:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HkdXo
function name:  _nice_r_h
number of ops:  8
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   RECV                                             !0      
   45     1        INIT_FCALL                                               'htmlspecialchars'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 3
          4        SEND_VAL                                                 'UTF-8'
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
   46     7*     > RETURN                                                   null

End of function _nice_r_h

Function _nice_r_kv:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
9 jumps found. (Code = 188) Position 1 = 29, Position 2 = 35, Position 3 = 35, Position 4 = 38, Position 5 = 44, Position 6 = 53, Position 7 = 58, Position 8 = 69, Position 9 = 14
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
2 jumps found. (Code = 43) Position 1 = 74, Position 2 = 75
Branch analysis from position: 74
2 jumps found. (Code = 43) Position 1 = 99, Position 2 = 105
Branch analysis from position: 99
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 105
Branch analysis from position: 75
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 35
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 69
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 29
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 35
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 35
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 38
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 44
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 53
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 58
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 58
Branch analysis from position: 53
Branch analysis from position: 44
Branch analysis from position: 38
Branch analysis from position: 35
Branch analysis from position: 35
Branch analysis from position: 29
Branch analysis from position: 12
filename:       /in/HkdXo
function name:  _nice_r_kv
number of ops:  106
compiled vars:  !0 = $key, !1 = $val, !2 = $id, !3 = $p, !4 = $d, !5 = $t, !6 = $is_hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   49     2        BIND_STATIC                                              !2
          3        PRE_INC                                                  !2
   50     4        ASSIGN                                                   !3, ''
          5        ASSIGN                                                   !4, ''
          6        GET_TYPE                                         ~10     !1
          7        ASSIGN                                                   !5, ~10
   51     8        IS_EQUAL                                         ~12     !5, 'array'
          9      > JMPNZ_EX                                         ~12     ~12, ->12
         10    >   IS_EQUAL                                         ~13     !5, 'object'
         11        BOOL                                             ~12     ~13
         12    >   ASSIGN                                                   !6, ~12
   52    13      > SWITCH_STRING                                            !5, [ 'boolean':->29, 'integer':->35, 'double':->35, 'string':->38, 'resource':->44, 'array':->53, 'object':->58, ], ->69
   53    14    >   IS_EQUAL                                                 !5, 'boolean'
         15      > JMPNZ                                                    ~15, ->29
   56    16    >   IS_EQUAL                                                 !5, 'integer'
         17      > JMPNZ                                                    ~15, ->35
   57    18    >   IS_EQUAL                                                 !5, 'double'
         19      > JMPNZ                                                    ~15, ->35
   60    20    >   IS_EQUAL                                                 !5, 'string'
         21      > JMPNZ                                                    ~15, ->38
   64    22    >   IS_EQUAL                                                 !5, 'resource'
         23      > JMPNZ                                                    ~15, ->44
   68    24    >   IS_EQUAL                                                 !5, 'array'
         25      > JMPNZ                                                    ~15, ->53
   71    26    >   IS_EQUAL                                                 !5, 'object'
         27      > JMPNZ                                                    ~15, ->58
         28    > > JMP                                                      ->69
   54    29    > > JMPZ                                                     !1, ->32
         30    >   QM_ASSIGN                                        ~16     'TRUE'
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~16     'FALSE'
         33    >   ASSIGN                                                   !3, ~16
   55    34      > JMP                                                      ->69
   58    35    >   CAST                                          6  ~18     !1
         36        ASSIGN                                                   !3, ~18
   59    37      > JMP                                                      ->69
   61    38    >   STRLEN                                           ~20     !1
         39        CONCAT                                           ~21     '%2C+', ~20
         40        CONCAT                                           ~22     ~21, '+characters'
         41        ASSIGN_OP                                     8          !4, ~22
   62    42        ASSIGN                                                   !3, !1
   63    43      > JMP                                                      ->69
   65    44    >   INIT_FCALL                                               'get_resource_type'
         45        SEND_VAR                                                 !1
         46        DO_ICALL                                         $25     
         47        CONCAT                                           ~26     '%2C+', $25
         48        CONCAT                                           ~27     ~26, '+type'
         49        ASSIGN_OP                                     8          !4, ~27
   66    50        CAST                                          6  ~29     !1
         51        ASSIGN                                                   !3, ~29
   67    52      > JMP                                                      ->69
   69    53    >   COUNT                                            ~31     !1
         54        CONCAT                                           ~32     '%2C+', ~31
         55        CONCAT                                           ~33     ~32, '+elements'
         56        ASSIGN_OP                                     8          !4, ~33
   70    57      > JMP                                                      ->69
   72    58    >   GET_CLASS                                        ~35     !1
         59        CONCAT                                           ~36     '%2C+', ~35
         60        CONCAT                                           ~37     ~36, '%2C+'
         61        INIT_FCALL                                               'get_object_vars'
         62        SEND_VAR                                                 !1
         63        DO_ICALL                                         $38     
         64        COUNT                                            ~39     $38
         65        CONCAT                                           ~40     ~37, ~39
         66        CONCAT                                           ~41     ~40, '+properties'
         67        ASSIGN_OP                                     8          !4, ~41
   73    68      > JMP                                                      ->69
   75    69    >   ECHO                                                     '%3Ca+href%3D%22javascript%3A%3B%22+onclick%3D%22nice_r_toggle%28%27'
         70        ECHO                                                     !2
         71        ECHO                                                     '%27%29%3B%22%3E%0A%09%09%09%3Cspan+class%3D%22nice_r_a'
   76    72        BOOL_NOT                                         ~43     !6
         73      > JMPZ                                                     ~43, ->75
         74    >   ECHO                                                     '+nice_r_ad'
         75    >   ECHO                                                     '%22+id%3D%22nice_r_a'
         76        ECHO                                                     !2
         77        ECHO                                                     '%22%3E%26%239658%3B%3C%2Fspan%3E%0A%09%09%09%3Cspan+class%3D%22nice_r_k%22%3E'
   77    78        INIT_FCALL                                               '_nice_r_h'
         79        SEND_VAR                                                 !0
         80        DO_FCALL                                      0  $44     
         81        ECHO                                                     $44
         82        ECHO                                                     '%3C%2Fspan%3E%0A%09%09%09%3Cspan+class%3D%22nice_r_d%22%3E%28'
   78    83        INIT_FCALL                                               'ucwords'
         84        SEND_VAR                                                 !5
         85        DO_ICALL                                         $45     
         86        CONCAT                                           ~46     '%3Cspan%3E', $45
         87        CONCAT                                           ~47     ~46, '%3C%2Fspan%3E'
         88        CONCAT                                           ~48     ~47, !4
         89        ECHO                                                     ~48
         90        ECHO                                                     '%29%3C%2Fspan%3E%0A%09%09%09%3Cspan+class%3D%22nice_r_p+nice_r_t_'
   79    91        ECHO                                                     !5
         92        ECHO                                                     '%22%3E'
         93        INIT_FCALL                                               '_nice_r_h'
         94        SEND_VAR                                                 !3
         95        DO_FCALL                                      0  $49     
         96        ECHO                                                     $49
         97        ECHO                                                     '%3C%2Fspan%3E%0A%09%09%3C%2Fa%3E'
   81    98      > JMPZ                                                     !6, ->105
   82    99    >   INIT_FCALL                                               '_nice_r_v'
        100        SEND_VAR                                                 !1
        101        SEND_VAL                                                 'nice_r_v'
        102        CONCAT                                           ~50     'nice_r_v', !2
        103        SEND_VAL                                                 ~50
        104        DO_FCALL                                      0          
   84   105    > > RETURN                                                   null

End of function _nice_r_kv

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.45 ms | 1410 KiB | 29 Q