3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! $factorial = call_user_func( function ($le) { return call_user_func( function ($f) { return $f($f); }, function ($f) use ($le) { return $le(function ($x) use ($f) { return call_user_func($f($f), $x); }); } ); }, function ($factorial) { return function ($x) use ($factorial) { if ($x > 0) { return $x * $factorial($x - 1); } return 1; }; } ); var_dump($factorial(1)); var_dump($factorial(2)); var_dump($factorial(3)); var_dump($factorial(4));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0q4u
function name:  (null)
number of ops:  31
compiled vars:  !0 = $factorial
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fh0q4u%3A5%240'
   16     1        INIT_USER_CALL                                1          'call_user_func', ~1
   17     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fh0q4u%3A17%244'
   24     3        SEND_USER                                                ~2
          4        DO_FCALL                                      0  $3      
    4     5        ASSIGN                                                   !0, $3
   27     6        INIT_FCALL                                               'var_dump'
          7        INIT_DYNAMIC_CALL                                        !0
          8        SEND_VAL_EX                                              1
          9        DO_FCALL                                      0  $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                                 
   28    12        INIT_FCALL                                               'var_dump'
         13        INIT_DYNAMIC_CALL                                        !0
         14        SEND_VAL_EX                                              2
         15        DO_FCALL                                      0  $7      
         16        SEND_VAR                                                 $7
         17        DO_ICALL                                                 
   29    18        INIT_FCALL                                               'var_dump'
         19        INIT_DYNAMIC_CALL                                        !0
         20        SEND_VAL_EX                                              3
         21        DO_FCALL                                      0  $9      
         22        SEND_VAR                                                 $9
         23        DO_ICALL                                                 
   30    24        INIT_FCALL                                               'var_dump'
         25        INIT_DYNAMIC_CALL                                        !0
         26        SEND_VAL_EX                                              4
         27        DO_FCALL                                      0  $11     
         28        SEND_VAR                                                 $11
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0q4u
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $le
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fh0q4u%3A7%241'
    9     2        INIT_USER_CALL                                1          'call_user_func', ~1
   10     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fh0q4u%3A10%242'
          4        BIND_LEXICAL                                             ~2, !0
   14     5        SEND_USER                                                ~2
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   16     8*     > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A7%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0q4u
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_DYNAMIC_CALL                                        !0
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
    9     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A7%241

Function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A10%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0q4u
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $f, !1 = $le
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   11     2        INIT_DYNAMIC_CALL                                        !1
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fh0q4u%3A11%243'
          4        BIND_LEXICAL                                             ~2, !0
   13     5        SEND_VAL_EX                                              ~2
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   14     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A10%242

Function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A11%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0q4u
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $x, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   12     2        INIT_DYNAMIC_CALL                                        !1
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0  $2      
          5        INIT_USER_CALL                                1          'call_user_func', $2
          6        SEND_USER                                                !0
          7        DO_FCALL                                      0  $3      
          8      > RETURN                                                   $3
   13     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A11%243

Function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A17%244:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0q4u
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $factorial
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fh0q4u%3A18%245'
          2        BIND_LEXICAL                                             ~1, !0
   23     3      > RETURN                                                   ~1
   24     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A17%244

Function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A18%245:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0q4u
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $x, !1 = $factorial
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   19     2        IS_SMALLER                                               0, !0
          3      > JMPZ                                                     ~2, ->10
   20     4    >   INIT_DYNAMIC_CALL                                        !1
          5        SUB                                              ~3      !0, 1
          6        SEND_VAL_EX                                              ~3
          7        DO_FCALL                                      0  $4      
          8        MUL                                              ~5      !0, $4
          9      > RETURN                                                   ~5
   22    10    > > RETURN                                                   1
   23    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fh0q4u%3A18%245

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.14 ms | 1404 KiB | 15 Q