3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A{} class B{} class CustomList extends ArrayObject{ protected $validType = 'A'; public function offsetSet($index, $val) { if(! $val instanceof $this->validType) { throw new \Exception('Cannot add item object of class '.get_class($val)); } } } $list = new CustomList(); $a = new A(); $b = new B(); $list[] = $a; $list[] = $b;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P7J2N
function name:  (null)
number of ops:  14
compiled vars:  !0 = $list, !1 = $a, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $3      'CustomList'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   17     3        NEW                                              $6      'A'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $6
   18     6        NEW                                              $9      'B'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $9
   19     9        ASSIGN_DIM                                               !0
         10        OP_DATA                                                  !1
   20    11        ASSIGN_DIM                                               !0
         12        OP_DATA                                                  !2
         13      > RETURN                                                   1

Class A: [no user functions]
Class B: [no user functions]
Class CustomList:
Function offsetset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P7J2N
function name:  offsetSet
number of ops:  14
compiled vars:  !0 = $index, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        FETCH_OBJ_R                                      ~2      'validType'
          3        FETCH_CLASS                                   0  $3      ~2
          4        INSTANCEOF                                       ~4      !1, $3
          5        BOOL_NOT                                         ~5      ~4
          6      > JMPZ                                                     ~5, ->13
   11     7    >   NEW                                              $6      'Exception'
          8        GET_CLASS                                        ~7      !1
          9        CONCAT                                           ~8      'Cannot+add+item+object+of+class+', ~7
         10        SEND_VAL_EX                                              ~8
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $6
   13    13    > > RETURN                                                   null

End of function offsetset

End of class CustomList.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.68 ms | 1399 KiB | 13 Q