3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Money { private $amount; public function __construct($amount) { $this->amount = $amount; } public function equals(Money $otherMoney) { return $this->amount === $otherMoney->amount; } } $a = new Money(1); $b = new Money(1); var_dump($a->equals($b)); echo $a->amount === 1;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5Jeov
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $2      'Money'
          1        SEND_VAL_EX                                              1
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   20     4        NEW                                              $5      'Money'
          5        SEND_VAL_EX                                              1
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   22     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'equals'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                                 
   23    14        FETCH_OBJ_R                                      ~10     !0, 'amount'
         15        IS_IDENTICAL                                     ~11     ~10, 1
         16        ECHO                                                     ~11
         17      > RETURN                                                   1

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

End of function __construct

Function equals:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5Jeov
function name:  equals
number of ops:  6
compiled vars:  !0 = $otherMoney
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        FETCH_OBJ_R                                      ~1      'amount'
          2        FETCH_OBJ_R                                      ~2      !0, 'amount'
          3        IS_IDENTICAL                                     ~3      ~1, ~2
          4      > RETURN                                                   ~3
   15     5*     > RETURN                                                   null

End of function equals

End of class Money.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.79 ms | 1396 KiB | 15 Q