3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sentence = 'Frank Sinatra'; echo $sentence . "<br/>\n"; echo removeEveryThirdLetter($sentence); function removeEveryThirdLetter($sentence) { $letters = str_split($sentence); foreach($letters as $key => $letter){ if($key > 0 && ($key+ 1) % 3 === 0){ unset($letters[$key]); } } return implode('', $letters); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n2CsB
function name:  (null)
number of ops:  8
compiled vars:  !0 = $sentence
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Frank+Sinatra'
    3     1        CONCAT                                           ~2      !0, '%3Cbr%2F%3E%0A'
          2        ECHO                                                     ~2
    4     3        INIT_FCALL_BY_NAME                                       'removeEveryThirdLetter'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $3      
          6        ECHO                                                     $3
   15     7      > RETURN                                                   1

Function removeeverythirdletter:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
Branch analysis from position: 14
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/n2CsB
function name:  removeEveryThirdLetter
number of ops:  24
compiled vars:  !0 = $sentence, !1 = $letters, !2 = $letter, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'str_split'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    9     5      > FE_RESET_R                                       $6      !1, ->17
          6    > > FE_FETCH_R                                       ~7      $6, !2, ->17
          7    >   ASSIGN                                                   !3, ~7
   10     8        IS_SMALLER                                       ~9      0, !3
          9      > JMPZ_EX                                          ~9      ~9, ->14
         10    >   ADD                                              ~10     !3, 1
         11        MOD                                              ~11     ~10, 3
         12        IS_IDENTICAL                                     ~12     ~11, 0
         13        BOOL                                             ~9      ~12
         14    > > JMPZ                                                     ~9, ->16
   11    15    >   UNSET_DIM                                                !1, !3
    9    16    > > JMP                                                      ->6
         17    >   FE_FREE                                                  $6
   14    18        INIT_FCALL                                               'implode'
         19        SEND_VAL                                                 ''
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $13     
         22      > RETURN                                                   $13
   15    23*     > RETURN                                                   null

End of function removeeverythirdletter

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.44 ms | 1400 KiB | 17 Q