3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bool2str($bool) { if ($bool === false) { return 'FALSE'; } else { return 'TRUE'; } } function compareObjects(&$o1, &$o2) { echo 'o1 == o2 : ' . bool2str($o1 == $o2) . "\n"; echo 'o1 != o2 : ' . bool2str($o1 != $o2) . "\n"; echo 'o1 === o2 : ' . bool2str($o1 === $o2) . "\n"; echo 'o1 !== o2 : ' . bool2str($o1 !== $o2) . "\n"; } class Flag { public $flag; function Flag($flag = true) { $this->flag = $flag; } } class OtherFlag { public $flag; function OtherFlag($flag = true) { $this->flag = $flag; } } $o = new Flag(); $p = new Flag(); $q = $o; $r = new OtherFlag(); echo "Two instances of the same class\n"; compareObjects($o, $p); echo "\nTwo references to the same instance\n"; compareObjects($o, $q); echo "\nInstances of two different classes\n"; compareObjects($o, $r); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FtRDO
function name:  (null)
number of ops:  26
compiled vars:  !0 = $o, !1 = $p, !2 = $q, !3 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   NEW                                              $4      'Flag'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   38     3        NEW                                              $7      'Flag'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $7
   39     6        ASSIGN                                                   !2, !0
   40     7        NEW                                              $11     'OtherFlag'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !3, $11
   42    10        ECHO                                                     'Two+instances+of+the+same+class%0A'
   43    11        INIT_FCALL                                               'compareobjects'
         12        SEND_REF                                                 !0
         13        SEND_REF                                                 !1
         14        DO_FCALL                                      0          
   45    15        ECHO                                                     '%0ATwo+references+to+the+same+instance%0A'
   46    16        INIT_FCALL                                               'compareobjects'
         17        SEND_REF                                                 !0
         18        SEND_REF                                                 !2
         19        DO_FCALL                                      0          
   48    20        ECHO                                                     '%0AInstances+of+two+different+classes%0A'
   49    21        INIT_FCALL                                               'compareobjects'
         22        SEND_REF                                                 !0
         23        SEND_REF                                                 !3
         24        DO_FCALL                                      0          
   50    25      > RETURN                                                   1

Function bool2str:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FtRDO
function name:  bool2str
number of ops:  7
compiled vars:  !0 = $bool
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        TYPE_CHECK                                    4          !0
          2      > JMPZ                                                     ~1, ->5
    5     3    > > RETURN                                                   'FALSE'
          4*       JMP                                                      ->6
    7     5    > > RETURN                                                   'TRUE'
    9     6*     > RETURN                                                   null

End of function bool2str

Function compareobjects:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FtRDO
function name:  compareObjects
number of ops:  31
compiled vars:  !0 = $o1, !1 = $o2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        INIT_FCALL                                               'bool2str'
          3        IS_EQUAL                                         ~2      !0, !1
          4        SEND_VAL                                                 ~2
          5        DO_FCALL                                      0  $3      
          6        CONCAT                                           ~4      'o1+%3D%3D+o2+%3A+', $3
          7        CONCAT                                           ~5      ~4, '%0A'
          8        ECHO                                                     ~5
   14     9        INIT_FCALL                                               'bool2str'
         10        IS_NOT_EQUAL                                     ~6      !0, !1
         11        SEND_VAL                                                 ~6
         12        DO_FCALL                                      0  $7      
         13        CONCAT                                           ~8      'o1+%21%3D+o2+%3A+', $7
         14        CONCAT                                           ~9      ~8, '%0A'
         15        ECHO                                                     ~9
   15    16        INIT_FCALL                                               'bool2str'
         17        IS_IDENTICAL                                     ~10     !0, !1
         18        SEND_VAL                                                 ~10
         19        DO_FCALL                                      0  $11     
         20        CONCAT                                           ~12     'o1+%3D%3D%3D+o2+%3A+', $11
         21        CONCAT                                           ~13     ~12, '%0A'
         22        ECHO                                                     ~13
   16    23        INIT_FCALL                                               'bool2str'
         24        IS_NOT_IDENTICAL                                 ~14     !0, !1
         25        SEND_VAL                                                 ~14
         26        DO_FCALL                                      0  $15     
         27        CONCAT                                           ~16     'o1+%21%3D%3D+o2+%3A+', $15
         28        CONCAT                                           ~17     ~16, '%0A'
         29        ECHO                                                     ~17
   17    30      > RETURN                                                   null

End of function compareobjects

Class Flag:
Function flag:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FtRDO
function name:  Flag
number of ops:  4
compiled vars:  !0 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV_INIT                                        !0      <true>
   24     1        ASSIGN_OBJ                                               'flag'
          2        OP_DATA                                                  !0
   25     3      > RETURN                                                   null

End of function flag

End of class Flag.

Class OtherFlag:
Function otherflag:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FtRDO
function name:  OtherFlag
number of ops:  4
compiled vars:  !0 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV_INIT                                        !0      <true>
   33     1        ASSIGN_OBJ                                               'flag'
          2        OP_DATA                                                  !0
   34     3      > RETURN                                                   null

End of function otherflag

End of class OtherFlag.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.06 ms | 1398 KiB | 20 Q