3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyObjectStorage extends SplObjectStorage { // Overwrite getHash() with just some (working) test-method public function getHash($object) { return get_class($object); } } class TestObject {} $list = new MyObjectStorage(); // No issues if using "new SplObjectStorage()" $list->attach(new TestObject()); foreach($list as $x) var_dump($list->offsetExists($x)); // TRUE $list2 = clone $list; foreach($list2 as $x) var_dump($list2->offsetExists($x)); // FALSE
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 29
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 17
filename:       /in/Kc9u1
function name:  (null)
number of ops:  31
compiled vars:  !0 = $list, !1 = $x, !2 = $list2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $3      'MyObjectStorage'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   10     3        INIT_METHOD_CALL                                         !0, 'attach'
          4        NEW                                              $6      'TestObject'
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $6
          7        DO_FCALL                                      0          
   12     8      > FE_RESET_R                                       $9      !0, ->17
          9    > > FE_FETCH_R                                               $9, !1, ->17
         10    >   INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !0, 'offsetExists'
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0  $10     
         14        SEND_VAR                                                 $10
         15        DO_ICALL                                                 
         16      > JMP                                                      ->9
         17    >   FE_FREE                                                  $9
   14    18        CLONE                                            ~12     !0
         19        ASSIGN                                                   !2, ~12
   15    20      > FE_RESET_R                                       $14     !2, ->29
         21    > > FE_FETCH_R                                               $14, !1, ->29
         22    >   INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !2, 'offsetExists'
         24        SEND_VAR_EX                                              !1
         25        DO_FCALL                                      0  $15     
         26        SEND_VAR                                                 $15
         27        DO_ICALL                                                 
         28      > JMP                                                      ->21
         29    >   FE_FREE                                                  $14
         30      > RETURN                                                   1

Class MyObjectStorage:
Function gethash:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Kc9u1
function name:  getHash
number of ops:  4
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        GET_CLASS                                        ~1      !0
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function gethash

End of class MyObjectStorage.

Class TestObject: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.22 ms | 1392 KiB | 15 Q