3v4l.org

run code in 500+ 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:  16
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        FRAMELESS_ICALL_3                str_replace         ~3      <array>, ''
          3        OP_DATA                                                      !0
          4        SEND_VAL                                                     ~3
          5        DO_ICALL                                             $4      
          6        ASSIGN                                                       !1, $4
    7     7        INIT_FCALL                                                   'preg_replace_callback'
    8     8        SEND_VAL                                                     '%7E%5B%5Eaeiou%5D%7E'
    9     9        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
         10        BIND_LEXICAL                                                 ~6, !1
   12    11        SEND_VAL                                                     ~6
   13    12        SEND_VAR                                                     !0
    7    13        DO_ICALL                                             $7      
   13    14        ECHO                                                         $7
         15      > 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:/in/AngF9:9}
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.5.0


preferences:
154.53 ms | 1163 KiB | 15 Q