Program to calculate Profit Or Loss | Function to calculate Profit . ; Function to calculate Loss . ; Driver Code .
< ? php function Profit ( $ costPrice , $ sellingPrice ) { $ profit = ( $ sellingPrice - $ costPrice ) ; return $ profit ; } function Loss ( $ costPrice , $ sellingPrice ) { $ Loss = ( $ costPrice - $ sellingPrice ) ; return $ Loss ; } $ costPrice = 1500 ; $ sellingPrice = 2000 ; if ( $ sellingPrice == $ costPrice ) echo " No ▁ profit ▁ nor ▁ Loss " ; else if ( $ sellingPrice > $ costPrice ) echo Profit ( $ costPrice , $ sellingPrice ) . " ▁ Profit ▁ " ; else echo Loss ( $ costPrice , $ sellingPrice ) . " ▁ Loss ▁ " ; ? >