3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Approximator { public static $wtfThreshold = 7; public static function __callStatic($name, $arguments) { $proximityMap = self::getProximityMap($name); for ($proximity = 0; $proximity <= (int) self::$wtfThreshold; $proximity++) { if (isset($proximityMap[$proximity][0])) { shuffle($proximityMap[$proximity]); return call_user_func_array($proximityMap[$proximity][0], $arguments); } } throw new Exception('Sorry, I-a don\'t understoond whet yooo meoont. Bork Bork Bork!'); } private static function getProximityMap($called) { $proximityMap = []; $definedMap = get_defined_functions(); foreach (array_merge($definedMap['internal'], $definedMap['user']) as $defined) { $proximityMap[levenshtein($called, $defined)][] = $defined; } return $proximityMap; } } var_dump(Approximator::string_to_upper('noodles'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4PTOv
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'Approximator', 'string_to_upper'
          2        SEND_VAL_EX                                              'noodles'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Class Approximator:
Function __callstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 8
Branch analysis from position: 27
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 8
Branch analysis from position: 27
Branch analysis from position: 8
filename:       /in/4PTOv
function name:  __callStatic
number of ops:  32
compiled vars:  !0 = $name, !1 = $arguments, !2 = $proximityMap, !3 = $proximity
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        INIT_STATIC_METHOD_CALL                                  'getProximityMap'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !2, $4
   11     6        ASSIGN                                                   !3, 0
          7      > JMP                                                      ->23
   12     8    >   FETCH_DIM_IS                                     ~7      !2, !3
          9        ISSET_ISEMPTY_DIM_OBJ                         0          ~7, 0
         10      > JMPZ                                                     ~8, ->22
   13    11    >   INIT_FCALL                                               'shuffle'
         12        FETCH_DIM_W                                      $9      !2, !3
         13        SEND_REF                                                 $9
         14        DO_ICALL                                                 
   14    15        FETCH_DIM_R                                      ~11     !2, !3
         16        FETCH_DIM_R                                      ~12     ~11, 0
         17        INIT_USER_CALL                                0          'call_user_func_array', ~12
         18        SEND_ARRAY                                               !1
         19        CHECK_UNDEF_ARGS                                         
         20        DO_FCALL                                      0  $13     
         21      > RETURN                                                   $13
   11    22    >   PRE_INC                                                  !3
         23    >   FETCH_STATIC_PROP_R          unknown             ~15     'wtfThreshold'
         24        CAST                                          4  ~16     ~15
         25        IS_SMALLER_OR_EQUAL                                      !3, ~16
         26      > JMPNZ                                                    ~17, ->8
   17    27    >   NEW                                              $18     'Exception'
         28        SEND_VAL_EX                                              'Sorry%2C+I-a+don%27t+understoond+whet+yooo+meoont.+Bork+Bork+Bork%21'
         29        DO_FCALL                                      0          
         30      > THROW                                         0          $18
   18    31*     > RETURN                                                   null

End of function __callstatic

Function getproximitymap:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/4PTOv
function name:  getProximityMap
number of ops:  24
compiled vars:  !0 = $called, !1 = $proximityMap, !2 = $definedMap, !3 = $defined
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        ASSIGN                                                   !1, <array>
   23     2        INIT_FCALL                                               'get_defined_functions'
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !2, $5
   24     5        INIT_FCALL                                               'array_merge'
          6        FETCH_DIM_R                                      ~7      !2, 'internal'
          7        SEND_VAL                                                 ~7
          8        FETCH_DIM_R                                      ~8      !2, 'user'
          9        SEND_VAL                                                 ~8
         10        DO_ICALL                                         $9      
         11      > FE_RESET_R                                       $10     $9, ->21
         12    > > FE_FETCH_R                                               $10, !3, ->21
   25    13    >   INIT_FCALL                                               'levenshtein'
         14        SEND_VAR                                                 !0
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $11     
         17        FETCH_DIM_W                                      $12     !1, $11
         18        ASSIGN_DIM                                               $12
         19        OP_DATA                                                  !3
   24    20      > JMP                                                      ->12
         21    >   FE_FREE                                                  $10
   27    22      > RETURN                                                   !1
   28    23*     > RETURN                                                   null

End of function getproximitymap

End of class Approximator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.56 ms | 1400 KiB | 23 Q