3v4l.org

run code in 300+ PHP versions simultaneously
<?php $word="developer"; $shuffled_consonants=str_shuffle(str_replace(['a','e','i','o','u'],'',$word)); // generate shuffled string of consonants // reinsert shuffled consonants at original consonant positions echo preg_replace_callback( '~[^aeiou]~', // match each consonant at original position function($m)use($shuffled_consonants){ // pass in the shuffled string static $offset=0; // init the offset counter return $shuffled_consonants[$offset++]; // insert new consonant at original position using post-incrementation }, $word);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AngF9
function name:  (null)
number of ops:  19
compiled vars:  !0 = $word, !1 = $shuffled_consonants
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'developer'
    4     1        INIT_FCALL                                               'str_shuffle'
          2        INIT_FCALL                                               'str_replace'
          3        SEND_VAL                                                 <array>
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !1, $4
    7    10        INIT_FCALL                                               'preg_replace_callback'
    8    11        SEND_VAL                                                 '%7E%5B%5Eaeiou%5D%7E'
    9    12        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
         13        BIND_LEXICAL                                             ~6, !1
   12    14        SEND_VAL                                                 ~6
   13    15        SEND_VAR                                                 !0
    7    16        DO_ICALL                                         $7      
   13    17        ECHO                                                     $7
         18      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AngF9
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $m, !1 = $shuffled_consonants, !2 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   10     2        BIND_STATIC                                              !2
   11     3        POST_INC                                         ~3      !2
          4        FETCH_DIM_R                                      ~4      !1, ~3
          5      > RETURN                                                   ~4
   12     6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.58 ms | 1000 KiB | 16 Q