3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $foo; public function __construct(string $foo) { $this->foo = $foo; } public function isEqualTo(self $otherFoo) { return $this->foo === $otherFoo->foo; } } $foo = new Foo('test'); $foo2 = new Foo('test'); var_dump($foo->isEqualTo($foo2)); $foo3 = new Foo('test'); $foo4 = new Foo('pest'); var_dump($foo3->isEqualTo($foo4));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MGspP
function name:  (null)
number of ops:  29
compiled vars:  !0 = $foo, !1 = $foo2, !2 = $foo3, !3 = $foo4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $4      'Foo'
          1        SEND_VAL_EX                                              'test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
   16     4        NEW                                              $7      'Foo'
          5        SEND_VAL_EX                                              'test'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
   18     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'isEqualTo'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0  $10     
         12        SEND_VAR                                                 $10
         13        DO_ICALL                                                 
   20    14        NEW                                              $12     'Foo'
         15        SEND_VAL_EX                                              'test'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !2, $12
   21    18        NEW                                              $15     'Foo'
         19        SEND_VAL_EX                                              'pest'
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !3, $15
   23    22        INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !2, 'isEqualTo'
         24        SEND_VAR_EX                                              !3
         25        DO_FCALL                                      0  $18     
         26        SEND_VAR                                                 $18
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

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

End of function __construct

Function isequalto:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MGspP
function name:  isEqualTo
number of ops:  6
compiled vars:  !0 = $otherFoo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        FETCH_OBJ_R                                      ~1      'foo'
          2        FETCH_OBJ_R                                      ~2      !0, 'foo'
          3        IS_IDENTICAL                                     ~3      ~1, ~2
          4      > RETURN                                                   ~3
   12     5*     > RETURN                                                   null

End of function isequalto

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.36 ms | 1003 KiB | 14 Q