3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "hello my friend"; $newString = ''; foreach(str_split($string) as $char) { $asciiCode = ord($char); // 97 - a // 122 - z if ($asciiCode >= 97 && $asciiCode < 122) { $char += 1; } if (in_array($char, ['a', 'e', 'y', 'u', 'i', 'o'])) { // not 32, because we already added 1 before $char -= 33; } $newString .= chr($char); } var_dump($newString);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 25
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 25
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 20
Branch analysis from position: 17
Branch analysis from position: 15
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/0BbuE
function name:  (null)
number of ops:  30
compiled vars:  !0 = $string, !1 = $newString, !2 = $char, !3 = $asciiCode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'hello+my+friend'
    3     1        ASSIGN                                                   !1, ''
    4     2        INIT_FCALL                                               'str_split'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $6      
          5      > FE_RESET_R                                       $7      $6, ->25
          6    > > FE_FETCH_R                                               $7, !2, ->25
    5     7    >   INIT_FCALL                                               'ord'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $8      
         10        ASSIGN                                                   !3, $8
    8    11        IS_SMALLER_OR_EQUAL                              ~10     97, !3
         12      > JMPZ_EX                                          ~10     ~10, ->15
         13    >   IS_SMALLER                                       ~11     !3, 122
         14        BOOL                                             ~10     ~11
         15    > > JMPZ                                                     ~10, ->17
    9    16    >   ASSIGN_OP                                     1          !2, 1
   11    17    >   IN_ARRAY                                                 !2, <array>
         18      > JMPZ                                                     ~13, ->20
   13    19    >   ASSIGN_OP                                     2          !2, 33
   15    20    >   INIT_FCALL                                               'chr'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $15     
         23        ASSIGN_OP                                     8          !1, $15
    4    24      > JMP                                                      ->6
         25    >   FE_FREE                                                  $7
   17    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.95 ms | 1396 KiB | 21 Q