3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ 'hello', 'leetcode', 'atwood' ]; foreach ($strings as &$string) { $count = preg_match_all('~[aeiou]~', $string, $m, PREG_OFFSET_CAPTURE); for ($i = 1; $i <= $count; ++$i) { $vowelOffset = $m[0][$count - $i][1]; $swappedVowel = $m[0][$i - 1][0]; $string[$vowelOffset] = $swappedVowel; } } var_export($strings);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 28
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 28
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 12
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 12
Branch analysis from position: 27
Branch analysis from position: 12
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/bMVt2
function name:  (null)
number of ops:  33
compiled vars:  !0 = $strings, !1 = $string, !2 = $count, !3 = $m, !4 = $i, !5 = $vowelOffset, !6 = $swappedVowel
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1      > FE_RESET_RW                                      $8      !0, ->28
          2    > > FE_FETCH_RW                                              $8, !1, ->28
   10     3    >   INIT_FCALL                                               'preg_match_all'
          4        SEND_VAL                                                 '%7E%5Baeiou%5D%7E'
          5        SEND_VAR                                                 !1
          6        SEND_REF                                                 !3
          7        SEND_VAL                                                 256
          8        DO_ICALL                                         $9      
          9        ASSIGN                                                   !2, $9
   11    10        ASSIGN                                                   !4, 1
         11      > JMP                                                      ->25
   12    12    >   SUB                                              ~13     !2, !4
         13        FETCH_DIM_R                                      ~12     !3, 0
         14        FETCH_DIM_R                                      ~14     ~12, ~13
         15        FETCH_DIM_R                                      ~15     ~14, 1
         16        ASSIGN                                                   !5, ~15
   13    17        SUB                                              ~18     !4, 1
         18        FETCH_DIM_R                                      ~17     !3, 0
         19        FETCH_DIM_R                                      ~19     ~17, ~18
         20        FETCH_DIM_R                                      ~20     ~19, 0
         21        ASSIGN                                                   !6, ~20
   14    22        ASSIGN_DIM                                               !1, !5
         23        OP_DATA                                                  !6
   11    24        PRE_INC                                                  !4
         25    >   IS_SMALLER_OR_EQUAL                                      !4, !2
         26      > JMPNZ                                                    ~24, ->12
    9    27    > > JMP                                                      ->2
         28    >   FE_FREE                                                  $8
   17    29        INIT_FCALL                                               'var_export'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
262.64 ms | 1012 KiB | 15 Q