3v4l.org

run code in 500+ PHP versions simultaneously
<?php namespace Ozzie; use Exception; use ReflectionClass; class Language { const DUTCH = 1; private static $languages_values; public static function getConstName($value) { if (isset(self::$languages_values[$value])) { return self::$languages_values[$value]; } throw new Exception('de value bestaat niet!'); } public static function init() { static $initialized = false; if ( ! $initialized) { $ref_class = new ReflectionClass(self::class); self::$languages_values = array_flip($ref_class->getConstants()); $initialized = true; } } } // ja, dit zet je in het zelfde bestand Language::init(); // nee, dit dan weer niet niet echo Language::getConstName(1), Language::getConstName(42);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bl4TO
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   36     0  E >   INIT_STATIC_METHOD_CALL                                      'Ozzie%5CLanguage', 'init'
          1        DO_FCALL                                          0          
   39     2        INIT_STATIC_METHOD_CALL                                      'Ozzie%5CLanguage', 'getConstName'
          3        SEND_VAL                                                     1
          4        DO_FCALL                                          0  $1      
          5        ECHO                                                         $1
          6        INIT_STATIC_METHOD_CALL                                      'Ozzie%5CLanguage', 'getConstName'
          7        SEND_VAL                                                     42
          8        DO_FCALL                                          0  $2      
          9        ECHO                                                         $2
         10      > RETURN                                                       1

Class Ozzie\Language:
Function getconstname:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/Bl4TO
function name:  getConstName
number of ops:  12
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
   15     1        FETCH_STATIC_PROP_IS                                 ~1      'languages_values'
          2        ISSET_ISEMPTY_DIM_OBJ                             0          ~1, !0
          3      > JMPZ                                                         ~2, ->7
   16     4    >   FETCH_STATIC_PROP_R              unknown             ~3      'languages_values'
          5        FETCH_DIM_R                                          ~4      ~3, !0
          6      > RETURN                                                       ~4
   19     7    >   NEW                                                  $5      'Exception'
          8        SEND_VAL_EX                                                  'de+value+bestaat+niet%21'
          9        DO_FCALL                                          0          
         10      > THROW                                             0          $5
   20    11*     > RETURN                                                       null

End of function getconstname

Function init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/Bl4TO
function name:  init
number of ops:  16
compiled vars:  !0 = $initialized, !1 = $ref_class
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   BIND_STATIC                                                  !0
   25     1        BOOL_NOT                                             ~2      !0
          2      > JMPZ                                                         ~2, ->15
   26     3    >   NEW                                                  $3      'ReflectionClass'
          4        SEND_VAL_EX                                                  'Ozzie%5CLanguage'
          5        DO_FCALL                                          0          
          6        ASSIGN                                                       !1, $3
   27     7        INIT_NS_FCALL_BY_NAME                                        'Ozzie%5Carray_flip'
          8        INIT_METHOD_CALL                                             !1, 'getConstants'
          9        DO_FCALL                                          0  $7      
         10        SEND_VAR_NO_REF_EX                                           $7
         11        DO_FCALL                                          0  $8      
         12        ASSIGN_STATIC_PROP                                           'languages_values'
         13        OP_DATA                                                      $8
   29    14        ASSIGN                                                       !0, <true>
   31    15    > > RETURN                                                       null

End of function init

End of class Ozzie\Language.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
233.54 ms | 2707 KiB | 14 Q