- array_rand: documentation ( source)
- in_array: documentation ( source)
<?php
$vowels = array('a','e','i','o','u');
$other = array();
$prev = null;
for ($x=0,$s=null,$s=null;$x<4;$x++) {
if (in_array($prev, $other)) {
$s .= array_rand($vowels);
} else {
$s .= array_rand($other);
}
$prev = $s;
}
echo $s;