p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: Has ELSE been deprecated?


Message #1 by Jefferis Peterson <jefferis@p...> on Tue, 22 Oct 2002 15:25:35 -0400
I keep getting errors on my if/else else if statements and I'm wondering if
it has be deprecated or if I'm just making a stupid error. This won't parse:

<?php 
$agent = getenv("HTTP_USER_AGENT");
echo $agent;
if (preg_match("/Win/i", "$agent")) {
$top = "50"; 
{
else {
$top = "100";
}


?>
~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.net
Tel .  xxx-xxx-xxxx
ICQ 19112253

http://www.Slippery-Rock.com - 7,000 hits per year

Message #2 by "Nikolai Devereaux" <yomama@u...> on Tue, 22 Oct 2002 12:36:35 -0700
Hate to say it, but it's a stupid error. =)  You're using an OPEN curly brace
instead of a CLOSE curly brace to end your if{} block.

> <?php
> $agent = getenv("HTTP_USER_AGENT");
> echo $agent;
> if (preg_match("/Win/i", "$agent")) {
> $top = "50";
> {                  <=======  HERE
> else {
> $top = "100";
> }
>
>
> ?>


take care,

nik

Message #3 by Jefferis Peterson <jefferis@p...> on Tue, 22 Oct 2002 15:38:22 -0400
NEVERMIND!    DOH!  { was backwards


On 10/22/02 3:25 PM, "Jefferis Peterson" <jefferis@p...> wrote:

> I keep getting errors on my if/else else if statements and I'm wondering if
> it has be deprecated or if I'm just making a stupid error. This won't parse:
> 
> <?php 
> $agent = getenv("HTTP_USER_AGENT");
> echo $agent;
> if (preg_match("/Win/i", "$agent")) {
> $top = "50"; 
> {
> else {
> $top = "100";
> }

~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.net
Tel .  xxx-xxx-xxxx
ICQ 19112253

http://www.Slippery-Rock.com - 7,000 hits per year


  Return to Index