3v4l.org

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

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

End of function __construct

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

End of function equals

End of class Money.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.73 ms | 1405 KiB | 15 Q