3v4l.org

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

Function partialleft:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kg5uP
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%2Fkg5uP%3A4%240'
          2        BIND_LEXICAL                                             ~1, !0
    8     3      > RETURN                                                   ~1
    9     4*     > RETURN                                                   null

End of function partialleft

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

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

Function %00%7Bclosure%7D%2Fin%2Fkg5uP%3A10%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kg5uP
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        CONCAT                                           ~2      !0, '+--+'
          3        CONCAT                                           ~3      ~2, !1
          4        ECHO                                                     ~3
          5      > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.03 ms | 1403 KiB | 14 Q