3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait Eq { abstract public function equiv(Eq $lhs, Eq $rhs): bool; } class Tuple2 { use Eq; public function __construct(public Eq $key, public Eq $value) {} public function equiv(Eq $lhs, Eq $rhs): bool { return $lhs->key->equiv($lhs->key, $rhs->key) && $lhs->value->equiv($lhs->value, $rhs->value); } } class Tuple3 { use Eq; public function __construct(public Eq $key, public Eq $value, public Eq $column) {} public function equiv(Eq $lhs, Eq $rhs): bool { return $lhs->key->equiv($lhs->key, $rhs->key) && $lhs->value->equiv($lhs->value, $rhs->value) && $lhs->column->equiv($lhs->column, $rhs->column); } } function check_equiv(Eq $lhs, Eq $rhs) { return $lhs->equiv($lhs, $rhs); } var_dump(check_equiv( new Tuple3(new Tuple2(1, 2), new Tuple2(3, 4), new Tuple2(5, 6)), new Tuple3(new Tuple2(1, 2), new Tuple2(3, 4), new Tuple2(5, 6)) ));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Hdmot
function name:  (null)
number of ops:  44
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   DECLARE_CLASS                                                'tuple2'
   17     1        DECLARE_CLASS                                                'tuple3'
   34     2        INIT_FCALL                                                   'var_dump'
          3        INIT_FCALL                                                   'check_equiv'
   35     4        NEW                                                  $0      'Tuple3'
          5        NEW                                                  $1      'Tuple2'
          6        SEND_VAL_EX                                                  1
          7        SEND_VAL_EX                                                  2
          8        DO_FCALL                                          0          
          9        SEND_VAR_NO_REF_EX                                           $1
         10        NEW                                                  $3      'Tuple2'
         11        SEND_VAL_EX                                                  3
         12        SEND_VAL_EX                                                  4
         13        DO_FCALL                                          0          
         14        SEND_VAR_NO_REF_EX                                           $3
         15        NEW                                                  $5      'Tuple2'
         16        SEND_VAL_EX                                                  5
         17        SEND_VAL_EX                                                  6
         18        DO_FCALL                                          0          
         19        SEND_VAR_NO_REF_EX                                           $5
         20        DO_FCALL                                          0          
         21        SEND_VAR                                                     $0
   36    22        NEW                                                  $8      'Tuple3'
         23        NEW                                                  $9      'Tuple2'
         24        SEND_VAL_EX                                                  1
         25        SEND_VAL_EX                                                  2
         26        DO_FCALL                                          0          
         27        SEND_VAR_NO_REF_EX                                           $9
         28        NEW                                                  $11     'Tuple2'
         29        SEND_VAL_EX                                                  3
         30        SEND_VAL_EX                                                  4
         31        DO_FCALL                                          0          
         32        SEND_VAR_NO_REF_EX                                           $11
         33        NEW                                                  $13     'Tuple2'
         34        SEND_VAL_EX                                                  5
         35        SEND_VAL_EX                                                  6
         36        DO_FCALL                                          0          
         37        SEND_VAR_NO_REF_EX                                           $13
         38        DO_FCALL                                          0          
         39        SEND_VAR                                                     $8
   34    40        DO_FCALL                                          0  $16     
   36    41        SEND_VAR                                                     $16
   34    42        DO_ICALL                                                     
   37    43      > RETURN                                                       1

Function check_equiv:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Hdmot
function name:  check_equiv
number of ops:  8
compiled vars:  !0 = $lhs, !1 = $rhs
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   29     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   31     2        INIT_METHOD_CALL                                             !0, 'equiv'
          3        SEND_VAR_EX                                                  !0
          4        SEND_VAR_EX                                                  !1
          5        DO_FCALL                                          0  $2      
          6      > RETURN                                                       $2
   32     7*     > RETURN                                                       null

End of function check_equiv

Class Eq:
Function equiv:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Hdmot
function name:  equiv
number of ops:  4
compiled vars:  !0 = $lhs, !1 = $rhs
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        VERIFY_RETURN_TYPE                                           
          3      > RETURN                                                       null

End of function equiv

End of class Eq.

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

End of function __construct

Function equiv:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 22
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/Hdmot
function name:  equiv
number of ops:  26
compiled vars:  !0 = $lhs, !1 = $rhs
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   13     2        FETCH_OBJ_R                                          ~2      !0, 'key'
          3        INIT_METHOD_CALL                                             ~2, 'equiv'
          4        CHECK_FUNC_ARG                                               
          5        FETCH_OBJ_FUNC_ARG                                   $3      !0, 'key'
          6        SEND_FUNC_ARG                                                $3
          7        CHECK_FUNC_ARG                                               
          8        FETCH_OBJ_FUNC_ARG                                   $4      !1, 'key'
          9        SEND_FUNC_ARG                                                $4
         10        DO_FCALL                                          0  $5      
         11      > JMPZ_EX                                              ~6      $5, ->22
         12    >   FETCH_OBJ_R                                          ~7      !0, 'value'
         13        INIT_METHOD_CALL                                             ~7, 'equiv'
         14        CHECK_FUNC_ARG                                               
         15        FETCH_OBJ_FUNC_ARG                                   $8      !0, 'value'
         16        SEND_FUNC_ARG                                                $8
         17        CHECK_FUNC_ARG                                               
         18        FETCH_OBJ_FUNC_ARG                                   $9      !1, 'value'
         19        SEND_FUNC_ARG                                                $9
         20        DO_FCALL                                          0  $10     
         21        BOOL                                                 ~6      $10
         22    >   VERIFY_RETURN_TYPE                                           ~6
         23      > RETURN                                                       ~6
   14    24*       VERIFY_RETURN_TYPE                                           
         25*     > RETURN                                                       null

End of function equiv

End of class Tuple2.

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

End of function __construct

Function equiv:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 22
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 33
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
Branch analysis from position: 22
filename:       /in/Hdmot
function name:  equiv
number of ops:  37
compiled vars:  !0 = $lhs, !1 = $rhs
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   23     2        FETCH_OBJ_R                                          ~2      !0, 'key'
          3        INIT_METHOD_CALL                                             ~2, 'equiv'
          4        CHECK_FUNC_ARG                                               
          5        FETCH_OBJ_FUNC_ARG                                   $3      !0, 'key'
          6        SEND_FUNC_ARG                                                $3
          7        CHECK_FUNC_ARG                                               
          8        FETCH_OBJ_FUNC_ARG                                   $4      !1, 'key'
          9        SEND_FUNC_ARG                                                $4
         10        DO_FCALL                                          0  $5      
         11      > JMPZ_EX                                              ~6      $5, ->22
   24    12    >   FETCH_OBJ_R                                          ~7      !0, 'value'
         13        INIT_METHOD_CALL                                             ~7, 'equiv'
         14        CHECK_FUNC_ARG                                               
         15        FETCH_OBJ_FUNC_ARG                                   $8      !0, 'value'
         16        SEND_FUNC_ARG                                                $8
         17        CHECK_FUNC_ARG                                               
         18        FETCH_OBJ_FUNC_ARG                                   $9      !1, 'value'
         19        SEND_FUNC_ARG                                                $9
         20        DO_FCALL                                          0  $10     
         21        BOOL                                                 ~6      $10
         22    > > JMPZ_EX                                              ~6      ~6, ->33
   25    23    >   FETCH_OBJ_R                                          ~11     !0, 'column'
         24        INIT_METHOD_CALL                                             ~11, 'equiv'
         25        CHECK_FUNC_ARG                                               
         26        FETCH_OBJ_FUNC_ARG                                   $12     !0, 'column'
         27        SEND_FUNC_ARG                                                $12
         28        CHECK_FUNC_ARG                                               
         29        FETCH_OBJ_FUNC_ARG                                   $13     !1, 'column'
         30        SEND_FUNC_ARG                                                $13
         31        DO_FCALL                                          0  $14     
         32        BOOL                                                 ~6      $14
         33    >   VERIFY_RETURN_TYPE                                           ~6
         34      > RETURN                                                       ~6
   26    35*       VERIFY_RETURN_TYPE                                           
         36*     > RETURN                                                       null

End of function equiv

End of class Tuple3.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
205.66 ms | 1794 KiB | 15 Q