3v4l.org

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

End of function g

Function %00%7Bclosure%7D%2Fin%2FLkFm7%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LkFm7
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%2FLkFm7%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.13 ms | 1394 KiB | 17 Q