3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LetterCounter { public static function CountLettersAsString(string $string) { $string = str_replace(" ", "", $string); $string = strtolower($string); $letters = str_split($string); foreach ($letters as $letter) { var_dump($letter); var_dump(array_filter($letters, function($key, $val) use ($letter) { return $val == $letter; }, ARRAY_FILTER_USE_BOTH)); } } } LetterCounter::CountLettersAsString("Test Gorilla");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UX8jn
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_STATIC_METHOD_CALL                                  'LetterCounter', 'CountLettersAsString'
          1        SEND_VAL                                                 'Test+Gorilla'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FUX8jn%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UX8jn
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $key, !1 = $val, !2 = $letter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   15     3        IS_EQUAL                                         ~3      !1, !2
          4      > RETURN                                                   ~3
   16     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FUX8jn%3A14%240

Class LetterCounter:
Function countlettersasstring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 31
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 31
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/UX8jn
function name:  CountLettersAsString
number of ops:  33
compiled vars:  !0 = $string, !1 = $letters, !2 = $letter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '+'
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !0, $3
    7     7        INIT_FCALL                                               'strtolower'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        ASSIGN                                                   !0, $5
    8    11        INIT_FCALL                                               'str_split'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $7      
         14        ASSIGN                                                   !1, $7
   10    15      > FE_RESET_R                                       $9      !1, ->31
         16    > > FE_FETCH_R                                               $9, !2, ->31
   13    17    >   INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
   14    20        INIT_FCALL                                               'var_dump'
         21        INIT_FCALL                                               'array_filter'
         22        SEND_VAR                                                 !1
         23        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FUX8jn%3A14%240'
         24        BIND_LEXICAL                                             ~11, !2
   16    25        SEND_VAL                                                 ~11
         26        SEND_VAL                                                 1
         27        DO_ICALL                                         $12     
         28        SEND_VAR                                                 $12
         29        DO_ICALL                                                 
   10    30      > JMP                                                      ->16
         31    >   FE_FREE                                                  $9
   19    32      > RETURN                                                   null

End of function countlettersasstring

End of class LetterCounter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
128.08 ms | 1405 KiB | 23 Q