3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Go { public function if (bool $cond): Go { return $this; } public function then(callable $func): Go { return $this; } } $go = (new Go)->if(5 > 3)->then(function () {echo 'YAY!';}); var_dump($go);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6vm2c
function name:  (null)
number of ops:  14
compiled vars:  !0 = $go
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $1      'Go'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $1, 'if'
          3        SEND_VAL_EX                                              <true>
          4        DO_FCALL                                      0  $3      
          5        INIT_METHOD_CALL                                         $3, 'then'
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F6vm2c%3A13%240'
          7        SEND_VAL_EX                                              ~4
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !0, $5
   14    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F6vm2c%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6vm2c
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     'YAY%21'
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F6vm2c%3A13%240

Class Go:
Function if:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6vm2c
function name:  if
number of ops:  6
compiled vars:  !0 = $cond
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        FETCH_THIS                                       ~1      
          2        VERIFY_RETURN_TYPE                                       ~1
          3      > RETURN                                                   ~1
    6     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function if

Function then:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6vm2c
function name:  then
number of ops:  6
compiled vars:  !0 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        FETCH_THIS                                       ~1      
          2        VERIFY_RETURN_TYPE                                       ~1
          3      > RETURN                                                   ~1
   10     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function then

End of class Go.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.64 ms | 1396 KiB | 15 Q