3v4l.org

run code in 300+ PHP versions simultaneously
<?php function g($x=0){return$x?:function($y)use($x){return$x.g($y);};} 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/d94HT
function name:  (null)
number of ops:  33
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'g'
          1        SEND_VAL                                                 'al'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4        ECHO                                                     '%0A'
    5     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'
    6    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'
    7    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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d94HT
function name:  g
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      0
          1        JMP_SET                                          ~1      !0, ->5
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd94HT%3A2%240'
          3        BIND_LEXICAL                                             ~2, !0
          4        QM_ASSIGN                                        ~1      ~2
          5      > RETURN                                                   ~1
          6*     > RETURN                                                   null

End of function g

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.66 ms | 1403 KiB | 17 Q