3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected $protectedVariable; public function __construct() { $this->protectedVariable = 'this belongs to test class'; } public function addByNo($adder) { return 10 + $adder; } } $x = new class (10) extends Test { public $holder; public $publicVar; public function __construct($classArg) { parent::__construct(); $this->holder = $classArg; } public function multiplyByNo($multiplier) { return $this->holder * $multiplier; } }; $testObject = new Test(); $templateFunction = function ($someNumber) { return $this->addByNo($someNumber); }; var_dump($testObject->call($templateFunction, 10));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OuHNi
function name:  (null)
number of ops:  18
compiled vars:  !0 = $x, !1 = $testObject, !2 = $templateFunction
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   DECLARE_ANON_CLASS                               <unknown> 'test'
          1        NEW                                              $4      $3
          2        SEND_VAL_EX                                              10
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $4
   34     5        NEW                                              $7      'Test'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
   35     8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FOuHNi%3A35%241'
          9        ASSIGN                                                   !2, ~10
   36    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !1, 'call'
         12        SEND_VAR_EX                                              !2
         13        SEND_VAL_EX                                              10
         14        DO_FCALL                                      0  $12     
         15        SEND_VAR                                                 $12
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FOuHNi%3A35%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OuHNi
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $someNumber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        FETCH_THIS                                       $1      
          2        INIT_METHOD_CALL                                         $1, 'addByNo'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FOuHNi%3A35%241

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OuHNi
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                               'protectedVariable'
          1        OP_DATA                                                  'this+belongs+to+test+class'
   10     2      > RETURN                                                   null

End of function __construct

Function addbyno:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OuHNi
function name:  addByNo
number of ops:  4
compiled vars:  !0 = $adder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        ADD                                              ~1      10, !0
          2      > RETURN                                                   ~1
   15     3*     > RETURN                                                   null

End of function addbyno

End of class Test.

Class Test@anonymous:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OuHNi
function name:  __construct
number of ops:  6
compiled vars:  !0 = $classArg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1        INIT_STATIC_METHOD_CALL                                  
          2        DO_FCALL                                      0          
   25     3        ASSIGN_OBJ                                               'holder'
          4        OP_DATA                                                  !0
   26     5      > RETURN                                                   null

End of function __construct

Function multiplybyno:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OuHNi
function name:  multiplyByNo
number of ops:  5
compiled vars:  !0 = $multiplier
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   30     1        FETCH_OBJ_R                                      ~1      'holder'
          2        MUL                                              ~2      !0, ~1
          3      > RETURN                                                   ~2
   31     4*     > RETURN                                                   null

End of function multiplybyno

End of class Test@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.12 ms | 1400 KiB | 15 Q