Example in PHP
After variable, let’s try some basic program in PHP.
Sum of Two Numbers
<?php $fnum=10; $snum=40; $res=$fnum+$snum; echo " The sum =$res"; ?>
The output of this program as follows:-
Calculate Gross Salary
<?php $sal=10000; $hra=($sal*5)/100; $gross_sal=$sal+$hra; echo " The Gross Salary is $gross_sal"; ?>
In this code I only declare the variable but didn’t assign any value. The output of this code as follows:-
Similarly you can try many programs.