3v4l.org

run code in 300+ PHP versions simultaneously
<?php function startAt($x){ function incrementBy($y){ return $x + $y; } return incrementBy; } $closure1 = startAt(1); $closure2 = startAt(5); echo $closure1; echo "<br/>"; echo $closure2;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hT4nP
function name:  (null)
number of ops:  12
compiled vars:  !0 = $closure1, !1 = $closure2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'startat'
          1        SEND_VAL                                                 1
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !0, $2
   10     4        INIT_FCALL                                               'startat'
          5        SEND_VAL                                                 5
          6        DO_FCALL                                      0  $4      
          7        ASSIGN                                                   !1, $4
   12     8        ECHO                                                     !0
   14     9        ECHO                                                     '%3Cbr%2F%3E'
   15    10        ECHO                                                     !1
         11      > RETURN                                                   1

Function startat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hT4nP
function name:  startAt
number of ops:  5
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        DECLARE_FUNCTION                                         'incrementby'
    7     2        FETCH_CONSTANT                                   ~1      'incrementBy'
          3      > RETURN                                                   ~1
    8     4*     > RETURN                                                   null

End of function startat

Function %00incrementby%2Fin%2FhT4nP%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hT4nP
function name:  incrementBy
number of ops:  4
compiled vars:  !0 = $y, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ADD                                              ~2      !1, !0
          2      > RETURN                                                   ~2
    6     3*     > RETURN                                                   null

End of function %00incrementby%2Fin%2FhT4nP%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.76 ms | 1398 KiB | 15 Q