mercredi 2 août 2017

I'm trying to use a variable in if statement but it is not giving accurate value PHP

First off, I'm a complete noob.

The number comes from a form. If the number for example is -6 then it should print the opposite of it, which is 6.

I tested printing out the $negativeAbsoluteValue variable and it is indeed 6, but for some reason the the if/else is causing it not to work.

<?php
$negativeAbsoluteValue = strip_tags($_GET[number]) * -1;
    if(number< 0){
        echo("Luvun itseiasvo on {$negativeAbsoluteValue}");
    }elseif (number >= 0){
        echo("Luvun {$_GET[number]} itseisarvo on {$_GET[number]}.");
    }
?>

Aucun commentaire:

Enregistrer un commentaire