3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Identity { private $identity; public function __construct($identiy) { $this->identity = $identiy; } public function getIdentity($value) { $func = $this->identity; return $func($value); } } $identity = new Identity(function ($value){ return "1"; }); echo $identity->getIdentity(1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/clKtL
function name:  (null)
number of ops:  10
compiled vars:  !0 = $identity
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'Identity'
          1        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   19     2        SEND_VAL_EX                                              ~2
   17     3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   20     5        INIT_METHOD_CALL                                         !0, 'getIdentity'
          6        SEND_VAL_EX                                              1
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
          9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/clKtL
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1      > RETURN                                                   '1'
   19     2*     > RETURN                                                   null

End of Dynamic Function 0

Class Identity:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/clKtL
function name:  __construct
number of ops:  4
compiled vars:  !0 = $identiy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN_OBJ                                               'identity'
          2        OP_DATA                                                  !0
    8     3      > RETURN                                                   null

End of function __construct

Function getidentity:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/clKtL
function name:  getIdentity
number of ops:  8
compiled vars:  !0 = $value, !1 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        FETCH_OBJ_R                                      ~2      'identity'
          2        ASSIGN                                                   !1, ~2
   12     3        INIT_DYNAMIC_CALL                                        !1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $4      
          6      > RETURN                                                   $4
   13     7*     > RETURN                                                   null

End of function getidentity

End of class Identity.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.35 ms | 1008 KiB | 13 Q