help: how to simplify algebraic expression!

hi, we can simplify the numbers very easily in php, like:

<?php echo 2+3-1 ?>

//which outputs: 4

but, how to simplify an algebraic expression like:
2x+3x-x to result the output 4x?

thanks
:slight_smile:

You write a function:

[php]function funcSums($intNumber){
$intNumber = ((2*$intNumber)+(3*$intNumber)-$intNumber);
return $intNumber;
}

echo funcSums(5)[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service