3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string="developer"; $consonants=[]; for($offset=0, $length=strlen($string); $offset<$length; ++$offset){ // iterate each letter of the string if(strpos('aeiou',$string[$offset])===false){ // isolate the consonants $consonants[]=$string[$offset]; // store the consonant $offsets[]=$offset; // store the offset (aka indexed position of the consonant in the string) } } shuffle($consonants); // shuffle the array of stored consonants foreach($consonants as $index=>$consonant){ // iterate only the stored consonants $string[$offsets[$index]]=$consonant; // reassign the consonants in their new positions } echo $string;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 6
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 6
Branch analysis from position: 21
Branch analysis from position: 6
Branch analysis from position: 18
filename:       /in/YFtvv
function name:  (null)
number of ops:  34
compiled vars:  !0 = $string, !1 = $consonants, !2 = $offset, !3 = $length, !4 = $offsets, !5 = $consonant, !6 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'developer'
    3     1        ASSIGN                                                   !1, <array>
    4     2        ASSIGN                                                   !2, 0
          3        STRLEN                                           ~10     !0
          4        ASSIGN                                                   !3, ~10
          5      > JMP                                                      ->19
    5     6    >   INIT_FCALL                                               'strpos'
          7        SEND_VAL                                                 'aeiou'
          8        FETCH_DIM_R                                      ~12     !0, !2
          9        SEND_VAL                                                 ~12
         10        DO_ICALL                                         $13     
         11        TYPE_CHECK                                    4          $13
         12      > JMPZ                                                     ~14, ->18
    6    13    >   FETCH_DIM_R                                      ~16     !0, !2
         14        ASSIGN_DIM                                               !1
         15        OP_DATA                                                  ~16
    7    16        ASSIGN_DIM                                               !4
         17        OP_DATA                                                  !2
    4    18    >   PRE_INC                                                  !2
         19    >   IS_SMALLER                                               !2, !3
         20      > JMPNZ                                                    ~19, ->6
   10    21    >   INIT_FCALL                                               'shuffle'
         22        SEND_REF                                                 !1
         23        DO_ICALL                                                 
   12    24      > FE_RESET_R                                       $21     !1, ->31
         25    > > FE_FETCH_R                                       ~22     $21, !5, ->31
         26    >   ASSIGN                                                   !6, ~22
   13    27        FETCH_DIM_R                                      ~24     !4, !6
         28        ASSIGN_DIM                                               !0, ~24
         29        OP_DATA                                                  !5
   12    30      > JMP                                                      ->25
         31    >   FE_FREE                                                  $21
   16    32        ECHO                                                     !0
   17    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.19 ms | 1004 KiB | 15 Q