3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { const STATUS_ACTIVE = 'active'; const STATUS_BLOCKED = 'blocked'; private static $props = [ self::STATUS_ACTIVE, self::STATUS_BLOCKED, ]; public function setProp($prop) { if (!in_array($prop, self::$props)) { throw new InvalidArgumentException(); } $this->prop = $prop; } } $a = new A(); $a->setProp(0); var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3rlhh
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        INIT_METHOD_CALL                                         !0, 'setProp'
          4        SEND_VAL_EX                                              0
          5        DO_FCALL                                      0          
   24     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class A:
Function setprop:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3rlhh
function name:  setProp
number of ops:  14
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'in_array'
          2        SEND_VAR                                                 !0
          3        FETCH_STATIC_PROP_R          global lock         ~1      'props'
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                         $2      
          6        BOOL_NOT                                         ~3      $2
          7      > JMPZ                                                     ~3, ->11
   14     8    >   NEW                                              $4      'InvalidArgumentException'
          9        DO_FCALL                                      0          
         10      > THROW                                         0          $4
   17    11    >   ASSIGN_OBJ                                               'prop'
         12        OP_DATA                                                  !0
   18    13      > RETURN                                                   null

End of function setprop

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.66 ms | 1395 KiB | 17 Q