Question : Please help with Pig Latin translation

How can i create a very simple simple Pig Latin translator with  built-in functions and regular expressions?

Answer : Please help with Pig Latin translation

Right. Here it is. You will need to add any more than 1 letter beginnings to the list of onsets. Just try it with lots of phrases and you should get there.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
function piglatin($text)
{
	// These are what we want to find at the start of each word, or failing that we will take the first letter.
	$onsets=implode('|', array('th', 'qu', 'br'));
	// Move the detected onset to the end and add 'ay'
	return preg_replace('~('.$onsets.'|\w)(\w*)~i', '$2$1ay', $text);
}

$text = 'The quick brown fox jumped over the lazy dog';
echo piglatin($text);
Random Solutions  
 
programming4us programming4us