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->equals($o2)) . "\n"; echo 'o1 != o2 : ' . bool2str($o1 instanceof $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(); compareObjects($o, $p); echo "\nЭкземпляры двух разных классов\n"; compareObjects($o, $r);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ZRMo
function name:  (null)
number of ops:  20
compiled vars:  !0 = $o, !1 = $p, !2 = $q, !3 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   NEW                                              $4      'Flag'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   36     3        NEW                                              $7      'Flag'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $7
   37     6        ASSIGN                                                   !2, !0
   38     7        NEW                                              $11     'OtherFlag'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !3, $11
   41    10        INIT_FCALL                                               'compareobjects'
         11        SEND_REF                                                 !0
         12        SEND_REF                                                 !1
         13        DO_FCALL                                      0          
   43    14        ECHO                                                     '%0A%D0%AD%D0%BA%D0%B7%D0%B5%D0%BC%D0%BF%D0%BB%D1%8F%D1%80%D1%8B+%D0%B4%D0%B2%D1%83%D1%85+%D1%80%D0%B0%D0%B7%D0%BD%D1%8B%D1%85+%D0%BA%D0%BB%D0%B0%D1%81%D1%81%D0%BE%D0%B2%0A'
   44    15        INIT_FCALL                                               'compareobjects'
         16        SEND_REF                                                 !0
         17        SEND_REF                                                 !3
         18        DO_FCALL                                      0          
         19      > 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/6ZRMo
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/6ZRMo
function name:  compareObjects
number of ops:  20
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        INIT_METHOD_CALL                                         !0, 'equals'
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_FCALL                                      0  $3      
          8        CONCAT                                           ~4      'o1+%3D%3D+o2+%3A+', $3
          9        CONCAT                                           ~5      ~4, '%0A'
         10        ECHO                                                     ~5
   14    11        INIT_FCALL                                               'bool2str'
         12        FETCH_CLASS                                   0  $6      !1
         13        INSTANCEOF                                       ~7      !0, $6
         14        SEND_VAL                                                 ~7
         15        DO_FCALL                                      0  $8      
         16        CONCAT                                           ~9      'o1+%21%3D+o2+%3A+', $8
         17        CONCAT                                           ~10     ~9, '%0A'
         18        ECHO                                                     ~10
   15    19      > 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/6ZRMo
function name:  Flag
number of ops:  4
compiled vars:  !0 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV_INIT                                        !0      <true>
   22     1        ASSIGN_OBJ                                               'flag'
          2        OP_DATA                                                  !0
   23     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/6ZRMo
function name:  OtherFlag
number of ops:  4
compiled vars:  !0 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV_INIT                                        !0      <true>
   31     1        ASSIGN_OBJ                                               'flag'
          2        OP_DATA                                                  !0
   32     3      > RETURN                                                   null

End of function otherflag

End of class OtherFlag.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.57 ms | 1403 KiB | 17 Q