3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Levenshteinable { public function __call($name, $arguments) { $levenshteins = []; foreach (get_class_methods(static::class) as $method) { $levenshteins[$method] = levenshtein($method, $name); } return [$this, array_search(min($levenshteins), $levenshteins)](...$arguments); } } class LevenshteinableDateTime extends DateTime { use Levenshteinable; } $dt = new LevenshteinableDateTime; echo $dt->fomrat('r');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I33XV
function name:  (null)
number of ops:  9
compiled vars:  !0 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   DECLARE_CLASS                                            'levenshteinabledatetime', 'datetime'
   18     1        NEW                                              $1      'LevenshteinableDateTime'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   19     4        INIT_METHOD_CALL                                         !0, 'fomrat'
          5        SEND_VAL_EX                                              'r'
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
          8      > RETURN                                                   1

Class Levenshteinable:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/I33XV
function name:  __call
number of ops:  33
compiled vars:  !0 = $name, !1 = $arguments, !2 = $levenshteins, !3 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        ASSIGN                                                   !2, <array>
    7     3        INIT_FCALL                                               'get_class_methods'
          4        FETCH_CLASS_NAME                                 ~5      
          5        SEND_VAL                                                 ~5
          6        DO_ICALL                                         $6      
          7      > FE_RESET_R                                       $7      $6, ->16
          8    > > FE_FETCH_R                                               $7, !3, ->16
    8     9    >   INIT_FCALL                                               'levenshtein'
         10        SEND_VAR                                                 !3
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $9      
         13        ASSIGN_DIM                                               !2, !3
         14        OP_DATA                                                  $9
    7    15      > JMP                                                      ->8
         16    >   FE_FREE                                                  $7
   10    17        FETCH_THIS                                       ~10     
         18        INIT_ARRAY                                       ~11     ~10
         19        INIT_FCALL                                               'array_search'
         20        INIT_FCALL                                               'min'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $12     
         23        SEND_VAR                                                 $12
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $13     
         26        ADD_ARRAY_ELEMENT                                ~11     $13
         27        INIT_DYNAMIC_CALL                                        ~11
         28        SEND_UNPACK                                              !1
         29        CHECK_UNDEF_ARGS                                         
         30        DO_FCALL                                      1  $14     
         31      > RETURN                                                   $14
   11    32*     > RETURN                                                   null

End of function __call

End of class Levenshteinable.

Class LevenshteinableDateTime: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.99 ms | 1400 KiB | 21 Q