3v4l.org

run code in 300+ PHP versions simultaneously
<?php function partialLeft($cb) { return function($left) use ($cb) { return function($right) use ($cb, $left) { return $cb($left, $right); }; }; } $a = partialLeft(null); $b = $a("hello"); $c = $b("robert");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1BFMj
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'partialleft'
          1        SEND_VAL                                                 null
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !0, $3
   11     4        INIT_DYNAMIC_CALL                                        !0
          5        SEND_VAL_EX                                              'hello'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
   12     8        INIT_DYNAMIC_CALL                                        !1
          9        SEND_VAL_EX                                              'robert'
         10        DO_FCALL                                      0  $7      
         11        ASSIGN                                                   !2, $7
         12      > RETURN                                                   1

Function partialleft:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1BFMj
function name:  partialLeft
number of ops:  5
compiled vars:  !0 = $cb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F1BFMj%3A4%240'
          2        BIND_LEXICAL                                             ~1, !0
    8     3      > RETURN                                                   ~1
    9     4*     > RETURN                                                   null

End of function partialleft

Function %00%7Bclosure%7D%2Fin%2F1BFMj%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1BFMj
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $left, !1 = $cb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    5     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F1BFMj%3A5%241'
          3        BIND_LEXICAL                                             ~2, !1
          4        BIND_LEXICAL                                             ~2, !0
    7     5      > RETURN                                                   ~2
    8     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F1BFMj%3A4%240

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

End of function %00%7Bclosure%7D%2Fin%2F1BFMj%3A5%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.97 ms | 1403 KiB | 14 Q