If the function is not a constructor (or maybee even then?) if you have the class defined as above and a object created from it (IE. example). Then a call to $example->function(); would do as you want if the function is propperly defined:
function function(); //reservation for the reserved word function ;o)
{
if (condition) { ... return 1} else {return 0};
}
or:
function function();
{
if (condition) {... return 1}
else if (another_condition) {... return 2}
else return 0;
}
The function will now execute and check the conditions. If they are met it returns the appropriet value else it returns 0 ... (Am I right?)