PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function reverse_vowels($word) { preg_match_all('/[ayeiou]/i', $word, $matches); $vowels = $matches[0]; foreach(str_split($word) as $i=>$c) { echo $c; print_r($vowels); if (in_array($word[$i], $vowels)) { //echo $word[$i] . " => $i => " . array_pop($vowels) . PHP_EOL; //$word[$i] = array_pop($vowels); substr_replace($word, array_pop($vowels), $i, 1); } } return $word; } echo reverse_vowels('kakoy');
Show:  
Copy Clear