Re: If/else conditional statement ...
| From: | Bogdan Stancescu | Date: | Sun, 23 Dec 2001 20:19:32 +0000 |
| Subject: | Re: If/else conditional statement ... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78622@lists.php.net to get a copy of this message | ||
Make sure you close the accolade afterwords in PHP -- other than that, yes,
it works just fine!
For example this should work just fine:
---------
<?
for ($i=0;$i<10;$i++) {
if (!($i%3)) {
?>
Found a multiple of three!
<?
echo($i);
?><br><?
}
}
?>
----------
Bogdan
Robert Dyke wrote:
> Hello:
>
> In ASP I can write a Conditional statement like this:
>
> <% If $varA == True Then %>
> Straight HTML in here that only displays if $varA == True
> <% Else %>
> Straight HTML in here that only displays if $varA != True
> <% End if %>
>
> Translating this to PHP doesn't work:
>
> <? If ($varA == True) { ?> // error is generated here ...
>
> Is there some way to do it this way in PHP? I'd rather not create a huge
> variable and then echo that.
>
> Thanks in advance.
>
> Robert Dyke
> Montana Software
> http://www.montanasoft.com/
> robert@montanasoft.com
>
> * For the best results please include the text of this message (cut and
> paste if necessary) in your reply *
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net