Skip to content

Instantly share code, notes, and snippets.

@mikestratton
Created May 5, 2015 05:09
Show Gist options
  • Save mikestratton/51552661d65bc93f8298 to your computer and use it in GitHub Desktop.
Save mikestratton/51552661d65bc93f8298 to your computer and use it in GitHub Desktop.
Salary estimation based on experience. Take experience and age of a person as input. If the person is experienced and his age is equal to or more than 35 the salary of the person is 6000. Otherwise, if the person is experienced and his age is equal to or more than 28 but less than 35, then the salary should be 4800. For experienced person below …
<?php
echo "Enter the experience:";
$exp = trim(fgets(STDIN));
echo "Enter the age of the person:";
$age = trim(fgets(STDIN));
while ($exp == 0){
$salary = 2000;
echo $salary;
exit;
}
if ($age >= 35) {
$salary = 6000;
}
if ($age >= 28 and $age < 35) {
$salary = 4800;
}
if ($age > 28) {
$salary = 3000;
}
echo $salary;
exit;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment