I want to trigger a function based on a variable.
function sound_dog() { return \'woof\'; } function sound_cow() { return \'moo\'; } $animal = \'cow\'; print soun
http://php.net/manual/en/functions.variable-functions.php
To do your example, you'd do
$animal_function = "sound_$animal"; $animal_function();