3v4l.org

run code in 300+ PHP versions simultaneously
<?php function g($x=0){ return $x?'o':function($y){return 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/DSLEe
function name:  (null)
number of ops:  33
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'g'
          1        SEND_VAL                                                 'al'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4        ECHO                                                     '%0A'
    7     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'
    8    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'
    9    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 = 2, Position 2 = 4
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DSLEe
function name:  g
number of ops:  8
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      0
    3     1      > JMPZ                                                     !0, ->4
          2    >   QM_ASSIGN                                        ~1      'o'
          3      > JMP                                                      ->6
          4    >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDSLEe%3A3%240'
          5        QM_ASSIGN                                        ~1      ~2
          6    > > RETURN                                                   ~1
    4     7*     > RETURN                                                   null

End of function g

Function %00%7Bclosure%7D%2Fin%2FDSLEe%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DSLEe
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !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%2FDSLEe%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.95 ms | 1403 KiB | 17 Q