Home Calculate a function result with a variable in PHP
Reply: 0

Calculate a function result with a variable in PHP

Lawonama
1#
Lawonama Published in 2017-11-13 16:35:09Z

I have a function that calculates something and want to subtract the result from the variable $bebebe. The result $bebebe only shows the first variable being $testNew. It doesn't show the $testNew-$testest2. Any ideas?

<?php
function testEst() {
    if($_POST["maxkwhresultaat"] > 0){
        echo "" . $_POST['totaal'] . "";
    }
    else
    {
        echo "" . $_POST['maxkwh'] . "</p>";
    }
}
testEst();
?>

<?php
$testest2 = testEst();
$testNew = $_POST["totaal"];
$bebebe = $testNew-$testest2;
?>
    Result: <?php echo $bebebe?>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.370806 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO