In earlier versions, depending on the specific goal, you might find call_user_func() or call_user_func_array() helpful. Certain functions include a callback parameter, as well (again, depends on what you’re doing).
However, for what you’re doing, there’s no need.
Your “psuedocode” is very close to actual code: it’s a “conditional” code block, not a “callback.”
Also, you may notice that I used mysqli_* functions instead of mysql_*. ext/mysql is outdated; if you have any choice in the matter, you should not be using it. ext/mysqli or PDO are the recommended APIs for mysql.