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); echo $a->amount === 1;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BiuYe
function name:  (null)
number of ops:  12
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        FETCH_OBJ_R                                      ~8      !0, 'amount'
          9        IS_IDENTICAL                                     ~9      ~8, 1
         10        ECHO                                                     ~9
         11      > RETURN                                                   1

Class Money:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BiuYe
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/BiuYe
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:
184.56 ms | 1394 KiB | 13 Q