<?php
function add($number1, $number2){
$result= $number1+$number2;
return $result;
}
function divid($number1, $number2)
{
$result=$number1/$number2;
return $result;
}
function multip($number1, $number2)
{
$result=$number1*$number2;
return $result;
}
$sum = multip(add(10,10), add(10,10));
echo $sum;
?>
The usage of the divid function is the same of add and multip.
So you can use it in this way:
$sum = divid(add(10, 10), multip(add(10,10), add(10,10)));
Hello and welcome to PHPHelp,
why not just continue with what you are doing?
<?php
$sum = divide(multiply(add(10,10), add(10,10)), 20) ;
echo $sum;
function add($m, $n) { return $m + $n; }
function divide($m, $n) { return $m / $n; }
function multiply($m, $n) { return $m * $n; }
?>
however, you could just return the action in this example and eliminate the wasted variable. Use the function to check or validate parameters instead of setting a useless variable.
edit: by the way, your title was ridiculously long. I’ve editied the title to something more reasonable. Please summarize, such as, ‘how to add division to my equation’. Also, please include code blocks to render php more legible:
[code]
<?php
//your php code
?>
[/code]