Im trying to right a script that divides vowels and suffixes with a hyphen.
<?php
$string = 'celebrationing';
$patterns = array();
$patterns[0] = '/a/';
$patterns[1] = '/e/';
$patterns[2] = '/i/';
$patterns[3] = '/o/';
$patterns[4] = '/u/';
$patterns[5] = '/tion/';
$replacements = array();
$replacements[0] = '-a';
$replacements[1] = '-e';
$replacements[2] = '-i';
$replacements[3] = '-o';
$replacements[4] = '-u';
$replacements[5] = '-tion';
echo preg_replace($patterns, $replacements, $string);
?>
The script works fine for vowels, but when i comes to the suffix -tion, it isnt printing the hyphen.
Output: c-el-ebr-at-i-on-ing
What im thinking is the fact that both -i and -o are vowels is whats messing the whole process up.
How do I allow all six patterns to be recognized, with all instances of -tion superceding -i and -o?