The wife of a programmer tells him to go to the supermarket and get 10 eggs, if they have salami, take 2.
The programmer comes back home with 2 eggs.
Here's how he is thinking (if I have errors in my code, please send them by e-mail - for used functions refer to documentation of Going To The Super Market Programming )
include("superMarketFunctions.php");
function goToByEggs($eggs, $what) {
if(exists($what) {
$eggs = 2;
}
$result = buy($eggs);
if($result == 1) {
goBackHome();
} else {
runbackUpPlan();
goBackHome();
}
return 1;
}
goToByEggs(10, "Salami");