I want to trigger a function based on a variable.
function sound_dog() { return \'woof\'; } function sound_cow() { return \'moo\'; } $animal = \'cow\'; print soun
For PHP >= 7 you can use this way:
PHP >= 7
function sound_dog() { return 'woof'; } function sound_cow() { return 'moo'; } $animal = 'cow'; print ('sound_' . $animal)();