Have you ever wanted to calculate how much you will make weekly after taxes are taken out of each PayCheck?  I know that I did, and that’s why I made this script. The calculation is pretty simple, so the script is as well.

How can a script like this be useful?

• One can get a quick estimate of what they will make at a company.
• Generate quotes with the tax rate that’s added on too your hourly rate, so you make your desired amount.
• Parse the potential salary of jobs sent too an email, so no time is wasted looking at jobs that don’t have a desired pay.

Of course doing any of these things will require adding too the script.

``````// total-hours = 40 hours a week
// tax-rate = 16.5%
// hourly-rate = 11.50;

// formula to calculate weekly pay
// total-hours * hourly-rate = weekly-pay
// weekly-pay * (tax-rate/100) = total-deducted
// weekly-pay - total-deducted = total-weekly-pay

\$calculationInputs = array(
'total-hours' => 40,
'tax-rate' => 16.5 / 100,
'hourly-rate' => 11.50
);

// //the weekly pay before taxes.
\$calculationsResults = array('weekly-pay' => \$calculationInputs['total-hours'] * \$calculationInputs['hourly-rate'] );

// amount of taxes that will be deducted each week.
\$calculationsResults['total-deducted'] = \$calculationInputs['tax-rate'] * \$calculationsResults['weekly-pay'];

//total pay
\$calculationsResults['total-weekly-pay'] = \$calculationsResults['weekly-pay'] - \$calculationsResults['total-deducted'];

//see the results
//var_dump(\$calculationsResults);``````

Categories
PHP