3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Doge { private $name; public function __construct($name) { $this->name = $name; } public function getName() { return $this->name; } public function equalsWithSameType(self $other) { return ($other->name === $this->name); } public function equalsWithSubType(DogeCoin $sub) { return ($sub->name === $this->name); } public function equalsWithRandomType(SomethingElseCompletely $whatever_man) { return ($whatever_man->name === $this->name); } } class DogeCoin extends Doge { private $name; } class SomethingElseCompletely { private $name; public function __construct($name) { $this->name = $name; } } $first_doge = new Doge('a'); $second_doge = new Doge('a'); $doge_coin = new DogeCoin('a'); $something_else_completely = new SomethingElseCompletely('a'); var_dump($first_doge->equalsWithSameType($second_doge)); var_dump($first_doge->equalsWithSubType($doge_coin)); var_dump($first_doge->equalsWithRandomType($something_else_completely));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dsdtr
function name:  (null)
number of ops:  35
compiled vars:  !0 = $first_doge, !1 = $second_doge, !2 = $doge_coin, !3 = $something_else_completely
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   NEW                                              $4      'Doge'
          1        SEND_VAL_EX                                              'a'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
   49     4        NEW                                              $7      'Doge'
          5        SEND_VAL_EX                                              'a'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
   50     8        NEW                                              $10     'DogeCoin'
          9        SEND_VAL_EX                                              'a'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $10
   51    12        NEW                                              $13     'SomethingElseCompletely'
         13        SEND_VAL_EX                                              'a'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !3, $13
   53    16        INIT_FCALL                                               'var_dump'
         17        INIT_METHOD_CALL                                         !0, 'equalsWithSameType'
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0  $16     
         20        SEND_VAR                                                 $16
         21        DO_ICALL                                                 
   54    22        INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !0, 'equalsWithSubType'
         24        SEND_VAR_EX                                              !2
         25        DO_FCALL                                      0  $18     
         26        SEND_VAR                                                 $18
         27        DO_ICALL                                                 
   55    28        INIT_FCALL                                               'var_dump'
         29        INIT_METHOD_CALL                                         !0, 'equalsWithRandomType'
         30        SEND_VAR_EX                                              !3
         31        DO_FCALL                                      0  $20     
         32        SEND_VAR                                                 $20
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Class Doge:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dsdtr
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
   11     3      > 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/dsdtr
function name:  getName
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1      > RETURN                                                   ~0
   16     2*     > RETURN                                                   null

End of function getname

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

End of function equalswithsametype

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

End of function equalswithsubtype

Function equalswithrandomtype:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dsdtr
function name:  equalsWithRandomType
number of ops:  6
compiled vars:  !0 = $whatever_man
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   30     1        FETCH_OBJ_R                                      ~1      !0, 'name'
          2        FETCH_OBJ_R                                      ~2      'name'
          3        IS_IDENTICAL                                     ~3      ~1, ~2
          4      > RETURN                                                   ~3
   31     5*     > 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/dsdtr
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
   11     3      > 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/dsdtr
function name:  getName
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1      > RETURN                                                   ~0
   16     2*     > RETURN                                                   null

End of function getname

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

End of function equalswithsametype

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

End of function equalswithsubtype

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

End of function equalswithrandomtype

End of class DogeCoin.

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

End of function __construct

End of class SomethingElseCompletely.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.67 ms | 1400 KiB | 15 Q