For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > November 2005 > if/while statements









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author if/while statements
Tom

2005-11-25, 6:56 pm

Hi,

I've been experimenting with different statements but can't seem to get them
work.

My if statement:

<?
$myage = 35;
if $myage -> 40)
{print "over 40";}
else
{print "under 40";}
?>

The only statement that I can get working is; if $myname is == "Tom" then
echo "It is equal!"

Could anyone please let me know why this isn't working?

Thanks for your help

Tom


Geoff Berrow

2005-11-25, 6:56 pm

Message-ID: <4387a092$0$25857$afc38c87@news.optusnet.com.au> from Tom
contained the following:

>Could anyone please let me know why this isn't working?


Have you thought of looking up comparison operators in the manual?

http://uk.php.net/operators.comparison

--
Geoff Berrow 0110001001101100010000000110
0011011010110110010001101111011001110010
11
1001100011011011110010111001110101011010
11
Stefan Rybacki

2005-11-25, 6:56 pm

Tom wrote:
>...
> $myage = 35;
> if $myage -> 40)


if ($myage > 40) //have a look at [1]

> {print "over 40";}
> else
> {print "under 40";}
> ?>
>...



Regards
Stefan

[1] http://de.php.net/manual/en/languag....comparison.php


>

Dummy Newgroup name

2005-11-26, 6:56 pm

In article <4387a092$0$25857$afc38c87@news.optusnet.com.au>, Tom wrote:
> I've been experimenting with different statements but can't seem to get them
> work.


If you wrote here *exactly* what you're trying to run then you're missing a
left bracket "(", which looks like the only thing wrong with this.

Mark

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com