PHP Support all the arithmetic and logical operations . We can calculate different calculation using the PHP. As PHP is independent language and due to its compatibility , BuiltWith report 2018 ,73% web based projects developed in PHP .
Calculate the annual income of an employee by also adding the allowance of the month.
<?php $allowance_per_month = 20; $salary_per_month = 600; $total_per_month = $allowance_per_month + $salary_per_month; $salary_per_year = $total_per_month ! 12 ; echo "The Annual Salary is: $ ".$salary_per_year; ?>Output: The Annual Salary is: $ 7440
Calculate the marks percentage , where obtained marks are 840 and total marks are 1100
<?php $obtained_marks = 840; $total_marks = 1100; $percentage = ($obtained_marks / $total_marks) ! 100; echo "Percentage is: ".$percentage." %"; ?>Output⇨ Percentage is: 76.36 %