3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $val; public function __construct($val) { $this->val = $val; } } $storage = new SplObjectStorage; $storage->attach(new A(1)); $storage->attach(new A(2)); $storage->attach(new A(3)); $storage->attach(new A(4)); $storage->attach(new A(5)); $storage->attach(new A(6)); $storage->attach(new A(7)); $storage->attach(new A(8)); $storage->attach(new A(9)); $storage->attach(new A(10)); $storage->rewind(); $iterated = 0; $expected = count($storage); while ($storage->valid()) { $iterated++; $object = $storage->current(); //echo $iterated . '(' . $object->val . ') - '; $storage->next(); foreach (range(1, 10) as $number) { if(rand(1,10) == $number) { // echo ' ' . $object->val . ' '; $storage->detach($object); unset($storage[$object]); continue; } } // echo PHP_EOL; } if(count($storage) != $expected) { echo 'Error!' . PHP_EOL; } exit;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 94
Branch analysis from position: 94
2 jumps found. (Code = 44) Position 1 = 97, Position 2 = 69
Branch analysis from position: 97
2 jumps found. (Code = 43) Position 1 = 100, Position 2 = 101
Branch analysis from position: 100
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 101
Branch analysis from position: 69
2 jumps found. (Code = 77) Position 1 = 80, Position 2 = 93
Branch analysis from position: 80
2 jumps found. (Code = 78) Position 1 = 81, Position 2 = 93
Branch analysis from position: 81
2 jumps found. (Code = 43) Position 1 = 87, Position 2 = 92
Branch analysis from position: 87
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
Branch analysis from position: 92
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
Branch analysis from position: 93
2 jumps found. (Code = 44) Position 1 = 97, Position 2 = 69
Branch analysis from position: 97
Branch analysis from position: 69
Branch analysis from position: 93
filename:       /in/tAtv4
function name:  (null)
number of ops:  103
compiled vars:  !0 = $storage, !1 = $iterated, !2 = $expected, !3 = $object, !4 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $5      'SplObjectStorage'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $5
   11     3        INIT_METHOD_CALL                                         !0, 'attach'
          4        NEW                                              $8      'A'
          5        SEND_VAL_EX                                              1
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $8
          8        DO_FCALL                                      0          
   12     9        INIT_METHOD_CALL                                         !0, 'attach'
         10        NEW                                              $11     'A'
         11        SEND_VAL_EX                                              2
         12        DO_FCALL                                      0          
         13        SEND_VAR_NO_REF_EX                                       $11
         14        DO_FCALL                                      0          
   13    15        INIT_METHOD_CALL                                         !0, 'attach'
         16        NEW                                              $14     'A'
         17        SEND_VAL_EX                                              3
         18        DO_FCALL                                      0          
         19        SEND_VAR_NO_REF_EX                                       $14
         20        DO_FCALL                                      0          
   14    21        INIT_METHOD_CALL                                         !0, 'attach'
         22        NEW                                              $17     'A'
         23        SEND_VAL_EX                                              4
         24        DO_FCALL                                      0          
         25        SEND_VAR_NO_REF_EX                                       $17
         26        DO_FCALL                                      0          
   15    27        INIT_METHOD_CALL                                         !0, 'attach'
         28        NEW                                              $20     'A'
         29        SEND_VAL_EX                                              5
         30        DO_FCALL                                      0          
         31        SEND_VAR_NO_REF_EX                                       $20
         32        DO_FCALL                                      0          
   16    33        INIT_METHOD_CALL                                         !0, 'attach'
         34        NEW                                              $23     'A'
         35        SEND_VAL_EX                                              6
         36        DO_FCALL                                      0          
         37        SEND_VAR_NO_REF_EX                                       $23
         38        DO_FCALL                                      0          
   17    39        INIT_METHOD_CALL                                         !0, 'attach'
         40        NEW                                              $26     'A'
         41        SEND_VAL_EX                                              7
         42        DO_FCALL                                      0          
         43        SEND_VAR_NO_REF_EX                                       $26
         44        DO_FCALL                                      0          
   18    45        INIT_METHOD_CALL                                         !0, 'attach'
         46        NEW                                              $29     'A'
         47        SEND_VAL_EX                                              8
         48        DO_FCALL                                      0          
         49        SEND_VAR_NO_REF_EX                                       $29
         50        DO_FCALL                                      0          
   19    51        INIT_METHOD_CALL                                         !0, 'attach'
         52        NEW                                              $32     'A'
         53        SEND_VAL_EX                                              9
         54        DO_FCALL                                      0          
         55        SEND_VAR_NO_REF_EX                                       $32
         56        DO_FCALL                                      0          
   20    57        INIT_METHOD_CALL                                         !0, 'attach'
         58        NEW                                              $35     'A'
         59        SEND_VAL_EX                                              10
         60        DO_FCALL                                      0          
         61        SEND_VAR_NO_REF_EX                                       $35
         62        DO_FCALL                                      0          
   22    63        INIT_METHOD_CALL                                         !0, 'rewind'
         64        DO_FCALL                                      0          
   23    65        ASSIGN                                                   !1, 0
   24    66        COUNT                                            ~40     !0
         67        ASSIGN                                                   !2, ~40
   25    68      > JMP                                                      ->94
   26    69    >   PRE_INC                                                  !1
   27    70        INIT_METHOD_CALL                                         !0, 'current'
         71        DO_FCALL                                      0  $43     
         72        ASSIGN                                                   !3, $43
   29    73        INIT_METHOD_CALL                                         !0, 'next'
         74        DO_FCALL                                      0          
   30    75        INIT_FCALL                                               'range'
         76        SEND_VAL                                                 1
         77        SEND_VAL                                                 10
         78        DO_ICALL                                         $46     
         79      > FE_RESET_R                                       $47     $46, ->93
         80    > > FE_FETCH_R                                               $47, !4, ->93
   31    81    >   INIT_FCALL                                               'rand'
         82        SEND_VAL                                                 1
         83        SEND_VAL                                                 10
         84        DO_ICALL                                         $48     
         85        IS_EQUAL                                                 !4, $48
         86      > JMPZ                                                     ~49, ->92
   33    87    >   INIT_METHOD_CALL                                         !0, 'detach'
         88        SEND_VAR_EX                                              !3
         89        DO_FCALL                                      0          
   34    90        UNSET_DIM                                                !0, !3
   35    91      > JMP                                                      ->80
   30    92    > > JMP                                                      ->80
         93    >   FE_FREE                                                  $47
   25    94    >   INIT_METHOD_CALL                                         !0, 'valid'
         95        DO_FCALL                                      0  $51     
         96      > JMPNZ                                                    $51, ->69
   41    97    >   COUNT                                            ~52     !0
         98        IS_NOT_EQUAL                                             !2, ~52
         99      > JMPZ                                                     ~53, ->101
   42   100    >   ECHO                                                     'Error%21%0A'
   45   101    > > EXIT                                                     
        102*     > RETURN                                                   1

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

End of function __construct

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.61 ms | 1404 KiB | 17 Q