RE: [PHP-WIN] PHP My first function (help)!!!!
| From: | HKG) | Date: | Thu, 14 Aug 2003 10:43:18 +0000 |
| Subject: | RE: [PHP-WIN] PHP My first function (help)!!!! | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-21148@lists.php.net to get a copy of this message | ||
> You cannot use comparision operaters (<=, >=, >) with strings.
> When you put quotes around your variable it defines it to
> php as a string, which translated means that it's words, not
> numbers. So you could say
> if ("$total" == "lowprice") {
> code code code
> }
>
> but not say ("$total" >= 25) {
> code code code
> }
In fact you can say that, since php is type less and does implicit
casting, it will evaluate it as integer comparisment in both cases.
> Also, you have defined your intergers as strings.
Which is not a good practice, but it will work,
since php will keep track on the casting.
> You're much better off with comparision operators using only
> intergers rather than comparing two strings that should be intergers.
I agree with you.