3v4l.org

run code in 300+ PHP versions simultaneously
<?php function g($x=0){static$s='g';return $x?[$z=$s.$x,$s='g',$z][2]:[$s.='o',function($y=0){return g($y);}][1];} /* // g()('al'); $x=g();echo $x('al'); echo PHP_EOL; $x=g();$x=$x();echo $x('al'); */ echo g('al') , PHP_EOL; echo g()('al') , PHP_EOL; echo g()()('al') , PHP_EOL; echo g()()()('al') , PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BQ5MZ
function name:  (null)
number of ops:  33
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'g'
          1        SEND_VAL                                                 'al'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4        ECHO                                                     '%0A'
   13     5        INIT_FCALL                                               'g'
          6        DO_FCALL                                      0  $1      
          7        INIT_DYNAMIC_CALL                                        $1
          8        SEND_VAL_EX                                              'al'
          9        DO_FCALL                                      0  $2      
         10        ECHO                                                     $2
         11        ECHO                                                     '%0A'
   14    12        INIT_FCALL                                               'g'
         13        DO_FCALL                                      0  $3      
         14        INIT_DYNAMIC_CALL                                        $3
         15        DO_FCALL                                      0  $4      
         16        INIT_DYNAMIC_CALL                                        $4
         17        SEND_VAL_EX                                              'al'
         18        DO_FCALL                                      0  $5      
         19        ECHO                                                     $5
         20        ECHO                                                     '%0A'
   15    21        INIT_FCALL                                               'g'
         22        DO_FCALL                                      0  $6      
         23        INIT_DYNAMIC_CALL                                        $6
         24        DO_FCALL                                      0  $7      
         25        INIT_DYNAMIC_CALL                                        $7
         26        DO_FCALL                                      0  $8      
         27        INIT_DYNAMIC_CALL                                        $8
         28        SEND_VAL_EX                                              'al'
         29        DO_FCALL                                      0  $9      
         30        ECHO                                                     $9
         31        ECHO                                                     '%0A'
         32      > RETURN                                                   1

Function g:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BQ5MZ
function name:  g
number of ops:  20
compiled vars:  !0 = $x, !1 = $s, !2 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      0
          1        BIND_STATIC                                              !1
          2      > JMPZ                                                     !0, ->12
          3    >   CONCAT                                           ~3      !1, !0
          4        ASSIGN                                           ~4      !2, ~3
          5        INIT_ARRAY                                       ~5      ~4
          6        ASSIGN                                           ~6      !1, 'g'
          7        ADD_ARRAY_ELEMENT                                ~5      ~6
          8        ADD_ARRAY_ELEMENT                                ~5      !2
          9        FETCH_DIM_R                                      ~7      ~5, 2
         10        QM_ASSIGN                                        ~8      ~7
         11      > JMP                                                      ->18
         12    >   ASSIGN_OP                                     8  ~9      !1, 'o'
         13        INIT_ARRAY                                       ~10     ~9
         14        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBQ5MZ%3A2%240'
         15        ADD_ARRAY_ELEMENT                                ~10     ~11
         16        FETCH_DIM_R                                      ~12     ~10, 1
         17        QM_ASSIGN                                        ~8      ~12
         18    > > RETURN                                                   ~8
         19*     > RETURN                                                   null

End of function g

Function %00%7Bclosure%7D%2Fin%2FBQ5MZ%3A2%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BQ5MZ
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV_INIT                                        !0      0
          1        INIT_FCALL_BY_NAME                                       'g'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FBQ5MZ%3A2%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.95 ms | 1402 KiB | 17 Q