3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Doge { private $name; protected $whatever; public $yolo; public function __construct($name, $whatever = null) { $this->name = $name; $this->whatever = $whatever; } public function getName() { return $this->name; } public function getWhatever() { return $this->whatever; } public function equalsWithSameType(self $other) { if ($other->name === $this->name && $other->whatever === $this->whatever && $other->yolo === $this->yolo) { return true; } return false; } public function equalsWithSubType(DogeCoin $sub) { if ($sub->name === $this->name && $sub->whatever === $this->whatever && $sub->yolo === $this->yolo) { return true; } return false; } public function equalsWithRandomType(SomethingElseCompletely $whatever_man) { if ($whatever_man->name === $this->name && $whatever_man->whatever === $this->whatever && $whatever_man->yolo === $this->yolo) { return true; } return false; } } class DogeCoin extends Doge { private $name; } class SomethingElseCompletely { private $name; } $first_doge = new Doge('a'); $second_doge = new Doge('b'); $first_dogecoin = new DogeCoin('a'); $second_dogecoin = new DogeCoin('a'); $first_somethingelsecompletely = new SomethingElseCompletely('a'); $second_somethingelsecompletely = new SomethingElseCompletely('a'); // var_dump( // $first_doge, // $second_doge, // $first_dogecoin, // $second_dogecoin, // $first_somethingelsecompletely, // $second_somethingelsecompletely // ); var_dump($first_doge->equalsWithSameType($second_doge)); var_dump($first_doge->equalsWithSubType($first_dogecoin)); var_dump($first_doge->equalsWithRandomType($first_somethingelsecompletely));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uF2un
function name:  (null)
number of ops:  43
compiled vars:  !0 = $first_doge, !1 = $second_doge, !2 = $first_dogecoin, !3 = $second_dogecoin, !4 = $first_somethingelsecompletely, !5 = $second_somethingelsecompletely
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   72     0  E >   NEW                                              $6      'Doge'
          1        SEND_VAL_EX                                              'a'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $6
   73     4        NEW                                              $9      'Doge'
          5        SEND_VAL_EX                                              'b'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $9
   74     8        NEW                                              $12     'DogeCoin'
          9        SEND_VAL_EX                                              'a'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $12
   75    12        NEW                                              $15     'DogeCoin'
         13        SEND_VAL_EX                                              'a'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !3, $15
   76    16        NEW                                              $18     'SomethingElseCompletely'
         17        SEND_VAL_EX                                              'a'
         18        DO_FCALL                                      0          
         19        ASSIGN                                                   !4, $18
   77    20        NEW                                              $21     'SomethingElseCompletely'
         21        SEND_VAL_EX                                              'a'
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !5, $21
   88    24        INIT_FCALL                                               'var_dump'
         25        INIT_METHOD_CALL                                         !0, 'equalsWithSameType'
         26        SEND_VAR_EX                                              !1
         27        DO_FCALL                                      0  $24     
         28        SEND_VAR                                                 $24
         29        DO_ICALL                                                 
   89    30        INIT_FCALL                                               'var_dump'
         31        INIT_METHOD_CALL                                         !0, 'equalsWithSubType'
         32        SEND_VAR_EX                                              !2
         33        DO_FCALL                                      0  $26     
         34        SEND_VAR                                                 $26
         35        DO_ICALL                                                 
   90    36        INIT_FCALL                                               'var_dump'
         37        INIT_METHOD_CALL                                         !0, 'equalsWithRandomType'
         38        SEND_VAR_EX                                              !4
         39        DO_FCALL                                      0  $28     
         40        SEND_VAR                                                 $28
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

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

End of function __construct

Function getname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uF2un
function name:  getName
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1      > RETURN                                                   ~0
   18     2*     > RETURN                                                   null

End of function getname

Function getwhatever:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uF2un
function name:  getWhatever
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   FETCH_OBJ_R                                      ~0      'whatever'
          1      > RETURN                                                   ~0
   23     2*     > RETURN                                                   null

End of function getwhatever

Function equalswithsametype:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 9
filename:       /in/uF2un
function name:  equalsWithSameType
number of ops:  18
compiled vars:  !0 = $other
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   27     1        FETCH_OBJ_R                                      ~1      !0, 'name'
          2        FETCH_OBJ_R                                      ~2      'name'
          3        IS_IDENTICAL                                     ~3      ~1, ~2
          4      > JMPZ_EX                                          ~3      ~3, ->9
   28     5    >   FETCH_OBJ_R                                      ~4      !0, 'whatever'
          6        FETCH_OBJ_R                                      ~5      'whatever'
          7        IS_IDENTICAL                                     ~6      ~4, ~5
          8        BOOL                                             ~3      ~6
          9    > > JMPZ_EX                                          ~3      ~3, ->14
   29    10    >   FETCH_OBJ_R                                      ~7      !0, 'yolo'
         11        FETCH_OBJ_R                                      ~8      'yolo'
         12        IS_IDENTICAL                                     ~9      ~7, ~8
         13        BOOL                                             ~3      ~9
         14    > > JMPZ                                                     ~3, ->16
   31    15    > > RETURN                                                   <true>
   34    16    > > RETURN                                                   <false>
   35    17*     > RETURN                                                   null

End of function equalswithsametype

Function equalswithsubtype:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 9
filename:       /in/uF2un
function name:  equalsWithSubType
number of ops:  18
compiled vars:  !0 = $sub
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
   39     1        FETCH_OBJ_R                                      ~1      !0, 'name'
          2        FETCH_OBJ_R                                      ~2      'name'
          3        IS_IDENTICAL                                     ~3      ~1, ~2
          4      > JMPZ_EX                                          ~3      ~3, ->9
   40     5    >   FETCH_OBJ_R                                      ~4      !0, 'whatever'
          6        FETCH_OBJ_R                                      ~5      'whatever'
          7        IS_IDENTICAL                                     ~6      ~4, ~5
          8        BOOL                                             ~3      ~6
          9    > > JMPZ_EX                                          ~3      ~3, ->14
   41    10    >   FETCH_OBJ_R                                      ~7      !0, 'yolo'
         11        FETCH_OBJ_R                                      ~8      'yolo'
         12        IS_IDENTICAL                                     ~9      ~7, ~8
         13        BOOL                                             ~3      ~9
         14    > > JMPZ                                                     ~3, ->16
   43    15    > > RETURN                                                   <true>
   46    16    > > RETURN                                                   <false>
   47    17*     > RETURN                                                   null

End of function equalswithsubtype

Function equalswithrandomtype:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 9
filename:       /in/uF2un
function name:  equalsWithRandomType
number of ops:  18
compiled vars:  !0 = $whatever_man
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV                                             !0      
   51     1        FETCH_OBJ_R                                      ~1      !0, 'name'
          2        FETCH_OBJ_R                                      ~2      'name'
          3        IS_IDENTICAL                                     ~3      ~1, ~2
          4      > JMPZ_EX                                          ~3      ~3, ->9
   52     5    >   FETCH_OBJ_R                                      ~4      !0, 'whatever'
          6        FETCH_OBJ_R                                      ~5      'whatever'
          7        IS_IDENTICAL                                     ~6      ~4, ~5
          8        BOOL                                             ~3      ~6
          9    > > JMPZ_EX                                          ~3      ~3, ->14
   53    10    >   FETCH_OBJ_R                                      ~7      !0, 'yolo'
         11        FETCH_OBJ_R                                      ~8      'yolo'
         12        IS_IDENTICAL                                     ~9      ~7, ~8
         13        BOOL                                             ~3      ~9
         14    > > JMPZ                                                     ~3, ->16
   55    15    > > RETURN                                                   <true>
   58    16    > > RETURN                                                   <false>
   59    17*     > RETURN                                                   null

End of function equalswithrandomtype

End of class Doge.

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

End of function __construct

Function getname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uF2un
function name:  getName
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1      > RETURN                                                   ~0
   18     2*     > RETURN                                                   null

End of function getname

Function getwhatever:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uF2un
function name:  getWhatever
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   FETCH_OBJ_R                                      ~0      'whatever'
          1      > RETURN                                                   ~0
   23     2*     > RETURN                                                   null

End of function getwhatever

Function equalswithsametype:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 9
filename:       /in/uF2un
function name:  equalsWithSameType
number of ops:  18
compiled vars:  !0 = $other
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   27     1        FETCH_OBJ_R                                      ~1      !0, 'name'
          2        FETCH_OBJ_R                                      ~2      'name'
          3        IS_IDENTICAL                                     ~3      ~1, ~2
          4      > JMPZ_EX                                          ~3      ~3, ->9
   28     5    >   FETCH_OBJ_R                                      ~4      !0, 'whatever'
          6        FETCH_OBJ_R                                      ~5      'whatever'
          7        IS_IDENTICAL                                     ~6      ~4, ~5
          8        BOOL                                             ~3      ~6
          9    > > JMPZ_EX                                          ~3      ~3, ->14
   29    10    >   FETCH_OBJ_R                                      ~7      !0, 'yolo'
         11        FETCH_OBJ_R                                      ~8      'yolo'
         12        IS_IDENTICAL                                     ~9      ~7, ~8
         13        BOOL                                             ~3      ~9
         14    > > JMPZ                                                     ~3, ->16
   31    15    > > RETURN                                                   <true>
   34    16    > > RETURN                                                   <false>
   35    17*     > RETURN                                                   null

End of function equalswithsametype

Function equalswithsubtype:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 9
filename:       /in/uF2un
function name:  equalsWithSubType
number of ops:  18
compiled vars:  !0 = $sub
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
   39     1        FETCH_OBJ_R                                      ~1      !0, 'name'
          2        FETCH_OBJ_R                                      ~2      'name'
          3        IS_IDENTICAL                                     ~3      ~1, ~2
          4      > JMPZ_EX                                          ~3      ~3, ->9
   40     5    >   FETCH_OBJ_R                                      ~4      !0, 'whatever'
          6        FETCH_OBJ_R                                      ~5      'whatever'
          7        IS_IDENTICAL                                     ~6      ~4, ~5
          8        BOOL                                             ~3      ~6
          9    > > JMPZ_EX                                          ~3      ~3, ->14
   41    10    >   FETCH_OBJ_R                                      ~7      !0, 'yolo'
         11        FETCH_OBJ_R                                      ~8      'yolo'
         12        IS_IDENTICAL                                     ~9      ~7, ~8
         13        BOOL                                             ~3      ~9
         14    > > JMPZ                                                     ~3, ->16
   43    15    > > RETURN                                                   <true>
   46    16    > > RETURN                                                   <false>
   47    17*     > RETURN                                                   null

End of function equalswithsubtype

Function equalswithrandomtype:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 9
filename:       /in/uF2un
function name:  equalsWithRandomType
number of ops:  18
compiled vars:  !0 = $whatever_man
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV                                             !0      
   51     1        FETCH_OBJ_R                                      ~1      !0, 'name'
          2        FETCH_OBJ_R                                      ~2      'name'
          3        IS_IDENTICAL                                     ~3      ~1, ~2
          4      > JMPZ_EX                                          ~3      ~3, ->9
   52     5    >   FETCH_OBJ_R                                      ~4      !0, 'whatever'
          6        FETCH_OBJ_R                                      ~5      'whatever'
          7        IS_IDENTICAL                                     ~6      ~4, ~5
          8        BOOL                                             ~3      ~6
          9    > > JMPZ_EX                                          ~3      ~3, ->14
   53    10    >   FETCH_OBJ_R                                      ~7      !0, 'yolo'
         11        FETCH_OBJ_R                                      ~8      'yolo'
         12        IS_IDENTICAL                                     ~9      ~7, ~8
         13        BOOL                                             ~3      ~9
         14    > > JMPZ                                                     ~3, ->16
   55    15    > > RETURN                                                   <true>
   58    16    > > RETURN                                                   <false>
   59    17*     > RETURN                                                   null

End of function equalswithrandomtype

End of class DogeCoin.

Class SomethingElseCompletely: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.65 ms | 1416 KiB | 15 Q