3v4l.org

run code in 300+ PHP versions simultaneously
<?php class RegexTranslator { const INT = '[0-9]+'; const ALPHA = '[a-zA-Z_-]+'; const ALNUM = '[a-zA-Z0-9_-]+'; public static function translate($string) { if (!is_string($string)) { throw InvalidArgumentException(); } if (!defined(__CLASS__ . "::$string")) { throw new InvalidArgumentException('No regex translation found for this string'); } else { return constant(__CLASS__ . "::$string"); } } } echo RegexTranslator::translate('int');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asLBb
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_STATIC_METHOD_CALL                                  'RegexTranslator', 'translate'
          1        SEND_VAL                                                 'int'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Class RegexTranslator:
Function translate:
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 = 108) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asLBb
function name:  translate
number of ops:  28
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        TYPE_CHECK                                   64  ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->7
   12     4    >   INIT_FCALL_BY_NAME                                       'InvalidArgumentException'
          5        DO_FCALL                                      0  $3      
          6      > THROW                                         0          $3
   14     7    >   INIT_FCALL                                               'defined'
          8        NOP                                                      
          9        FAST_CONCAT                                      ~4      '%3A%3A', !0
         10        CONCAT                                           ~5      'RegexTranslator', ~4
         11        SEND_VAL                                                 ~5
         12        DO_ICALL                                         $6      
         13        BOOL_NOT                                         ~7      $6
         14      > JMPZ                                                     ~7, ->20
   15    15    >   NEW                                              $8      'InvalidArgumentException'
         16        SEND_VAL_EX                                              'No+regex+translation+found+for+this+string'
         17        DO_FCALL                                      0          
         18      > THROW                                         0          $8
         19*       JMP                                                      ->27
   19    20    >   INIT_FCALL                                               'constant'
         21        NOP                                                      
         22        FAST_CONCAT                                      ~10     '%3A%3A', !0
         23        CONCAT                                           ~11     'RegexTranslator', ~10
         24        SEND_VAL                                                 ~11
         25        DO_ICALL                                         $12     
         26      > RETURN                                                   $12
   21    27*     > RETURN                                                   null

End of function translate

End of class RegexTranslator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.05 ms | 1396 KiB | 17 Q