3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { const STATE_BLOCKED = 0; const STATE_VALIDATED = 1; const STATE_NOT_VALIDATED = 2; public static $states = [ User::STATE_BLOCKED => 'Bloqueado', User::STATE_VALIDATED => 'Normal', User::STATE_NOT_VALIDATED => 'Pendiente de validaciĆ³n', ]; public function setState($state) { if (!ctype_digit($state) or !array_key_exists($state, User::$states)) { throw new \InvalidArgumentException("bad state '$state'"); } echo 'ok'; } public function setUnvalidated() { $this->setState(User::STATE_NOT_VALIDATED); } } $u = new User(); $u->setUnvalidated();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jNi1Z
function name:  (null)
number of ops:  6
compiled vars:  !0 = $u
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $1      'User'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   31     3        INIT_METHOD_CALL                                         !0, 'setUnvalidated'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class User:
Function setstate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/jNi1Z
function name:  setState
number of ops:  20
compiled vars:  !0 = $state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'ctype_digit'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        BOOL_NOT                                         ~2      $1
          5      > JMPNZ_EX                                         ~2      ~2, ->10
          6    >   FETCH_STATIC_PROP_R          global lock         ~3      'states'
          7        ARRAY_KEY_EXISTS                                 ~4      !0, ~3
          8        BOOL_NOT                                         ~5      ~4
          9        BOOL                                             ~2      ~5
         10    > > JMPZ                                                     ~2, ->18
   19    11    >   NEW                                              $6      'InvalidArgumentException'
         12        ROPE_INIT                                     3  ~8      'bad+state+%27'
         13        ROPE_ADD                                      1  ~8      ~8, !0
         14        ROPE_END                                      2  ~7      ~8, '%27'
         15        SEND_VAL_EX                                              ~7
         16        DO_FCALL                                      0          
         17      > THROW                                         0          $6
   21    18    >   ECHO                                                     'ok'
   22    19      > RETURN                                                   null

End of function setstate

Function setunvalidated:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jNi1Z
function name:  setUnvalidated
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_METHOD_CALL                                         'setState'
          1        SEND_VAL_EX                                              2
          2        DO_FCALL                                      0          
   27     3      > RETURN                                                   null

End of function setunvalidated

End of class User.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.34 ms | 1396 KiB | 15 Q