3v4l.org

run code in 300+ PHP versions simultaneously
<?php function minimize($file) { return preg_replace('#(<\?php)\s+#S','$1 ',preg_replace('#\s*([(){}[\];,.:+<>*/%^=&?|$-])\s*#S', '$1', array_reduce(token_get_all(php_strip_whitespace($file)),function($c,$x){ static $s = [], $i=0; if ( is_string($x) ) return $c . $x; $_ = $x[1]; switch($x[0]){ case T_STRING: return $c . (defined($_) ? (is_bool($k=constant($_))||is_null($k)?$_:$k) : $_); case T_VARIABLE: return $c . (empty($s[$_]) ? ($s[$_] = '$_' . base_convert($i++,10,36)) : $s[$_]); case T_LOGICAL_OR: return $c . '||'; case T_LOGICAL_AND: return $c . '&&'; default: return $c . $_; } }))); } echo minimize(__FILE__);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pvOcX
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'minimize'
          1        SEND_VAL                                                 '%2Fin%2FpvOcX'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function minimize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pvOcX
function name:  minimize
number of ops:  24
compiled vars:  !0 = $file
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%23%28%3C%5C%3Fphp%29%5Cs%2B%23S'
          3        SEND_VAL                                                 '%241+'
          4        INIT_FCALL                                               'preg_replace'
          5        SEND_VAL                                                 '%23%5Cs%2A%28%5B%28%29%7B%7D%5B%5C%5D%3B%2C.%3A%2B%3C%3E%2A%2F%25%5E%3D%26%3F%7C%24-%5D%29%5Cs%2A%23S'
          6        SEND_VAL                                                 '%241'
    5     7        INIT_FCALL                                               'array_reduce'
          8        INIT_FCALL                                               'token_get_all'
          9        INIT_FCALL                                               'php_strip_whitespace'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $1      
         12        SEND_VAR                                                 $1
         13        DO_ICALL                                         $2      
         14        SEND_VAR                                                 $2
         15        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpvOcX%3A5%240'
   15    16        SEND_VAL                                                 ~3
         17        DO_ICALL                                         $4      
         18        SEND_VAR                                                 $4
         19        DO_ICALL                                         $5      
         20        SEND_VAR                                                 $5
         21        DO_ICALL                                         $6      
         22      > RETURN                                                   $6
   16    23*     > RETURN                                                   null

End of function minimize

Function %00%7Bclosure%7D%2Fin%2FpvOcX%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
6 jumps found. (Code = 187) Position 1 = 21, Position 2 = 43, Position 3 = 61, Position 4 = 64, Position 5 = 67, Position 6 = 12
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 39
Branch analysis from position: 25
2 jumps found. (Code = 47) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 33
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 56
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 21
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 43
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 61
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 64
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
Branch analysis from position: 64
Branch analysis from position: 61
Branch analysis from position: 43
Branch analysis from position: 21
filename:       /in/pvOcX
function name:  {closure}
number of ops:  72
compiled vars:  !0 = $c, !1 = $x, !2 = $s, !3 = $i, !4 = $_, !5 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
    7     4        TYPE_CHECK                                   64          !1
          5      > JMPZ                                                     ~6, ->8
          6    >   CONCAT                                           ~7      !0, !1
          7      > RETURN                                                   ~7
          8    >   FETCH_DIM_R                                      ~8      !1, 1
          9        ASSIGN                                                   !4, ~8
    8    10        FETCH_DIM_R                                      ~10     !1, 0
         11      > SWITCH_LONG                                              ~10, [ 311:->21, 315:->43, 264:->61, 266:->64, ], ->67
         12    >   CASE                                                     ~10, 311
         13      > JMPNZ                                                    ~11, ->21
         14    >   CASE                                                     ~10, 315
         15      > JMPNZ                                                    ~11, ->43
         16    >   CASE                                                     ~10, 264
         17      > JMPNZ                                                    ~11, ->61
         18    >   CASE                                                     ~10, 266
         19      > JMPNZ                                                    ~11, ->64
         20    > > JMP                                                      ->67
    9    21    >   INIT_FCALL                                               'defined'
         22        SEND_VAR                                                 !4
         23        DO_ICALL                                         $12     
         24      > JMPZ                                                     $12, ->39
         25    >   INIT_FCALL                                               'constant'
         26        SEND_VAR                                                 !4
         27        DO_ICALL                                         $13     
         28        ASSIGN                                           ~14     !5, $13
         29        TYPE_CHECK                                   12  ~15     ~14
         30      > JMPNZ_EX                                         ~15     ~15, ->33
         31    >   TYPE_CHECK                                    2  ~16     !5
         32        BOOL                                             ~15     ~16
         33    > > JMPZ                                                     ~15, ->36
         34    >   QM_ASSIGN                                        ~17     !4
         35      > JMP                                                      ->37
         36    >   QM_ASSIGN                                        ~17     !5
         37    >   QM_ASSIGN                                        ~18     ~17
         38      > JMP                                                      ->40
         39    >   QM_ASSIGN                                        ~18     !4
         40    >   CONCAT                                           ~19     !0, ~18
         41        FREE                                                     ~10
         42      > RETURN                                                   ~19
   10    43    >   ISSET_ISEMPTY_DIM_OBJ                         1          !2, !4
         44      > JMPZ                                                     ~20, ->56
         45    >   INIT_FCALL                                               'base_convert'
         46        POST_INC                                         ~22     !3
         47        SEND_VAL                                                 ~22
         48        SEND_VAL                                                 10
         49        SEND_VAL                                                 36
         50        DO_ICALL                                         $23     
         51        CONCAT                                           ~24     '%24_', $23
         52        ASSIGN_DIM                                       ~21     !2, !4
         53        OP_DATA                                                  ~24
         54        QM_ASSIGN                                        ~25     ~21
         55      > JMP                                                      ->58
         56    >   FETCH_DIM_R                                      ~26     !2, !4
         57        QM_ASSIGN                                        ~25     ~26
         58    >   CONCAT                                           ~27     !0, ~25
         59        FREE                                                     ~10
         60      > RETURN                                                   ~27
   11    61    >   CONCAT                                           ~28     !0, '%7C%7C'
         62        FREE                                                     ~10
         63      > RETURN                                                   ~28
   12    64    >   CONCAT                                           ~29     !0, '%26%26'
         65        FREE                                                     ~10
         66      > RETURN                                                   ~29
   13    67    >   CONCAT                                           ~30     !0, !4
         68        FREE                                                     ~10
         69      > RETURN                                                   ~30
         70*       FREE                                                     ~10
   15    71*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FpvOcX%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.8 ms | 1407 KiB | 28 Q