PDA

View Full Version : iif


Takara
07 May 2002, 03:01
I'm making a hack, and I'm wondering how to use iff as VB does. This is what is in newreply.php:

$ipaddress=iif(getenv("REMOTE_ADDR")!="",getenv("REMOTE_ADDR"),$HTTP_HOST);

Now, if I wanted to convert this:

if (getenv("HTTP_X_FORWARDED_FOR")!="") {
$proxyip=getenv("HTTP_X_FORWARDED_FOR");
}

to use iff, would it look something like this:
$proxyip=iif(getenv("HTTP_X_FORWARDED_FOR")!="",getenv("HTTP_X_FORWARDED_FOR"));


I'm not quite sure, at the end of the one VB uses there is ,$HTTP_HOST. I'm not sure what to replace that with, or with anything at all.

Thanks :bunny: (I just love that bunny ^^)

Mark Hensler
07 May 2002, 07:48
If you've just got to use it, try just NULL.

Takara
07 May 2002, 08:40
Oh, thanks. Whats it for anyway?

Chen
07 May 2002, 14:09
iif() is used to shorten simple:
if (whatever) {
// whatever
} else {
// whatever
}
blocks.

Takara
07 May 2002, 20:38
hehe, simmilar to the mirc iif then. Thankies you two!

Scott MacVicar
07 May 2002, 20:50
ooh another irc person what servers do you go on Takara?

Mark Hensler
07 May 2002, 20:53
it's also like the SQL version

Chen
07 May 2002, 20:57
Only on SQL it's just IF. :)

Takara
07 May 2002, 23:50
Originally posted by PPN
ooh another irc person what servers do you go on Takara?

irc.enterthegame.com

I hang out in the Ragnarok Online chans, though Im just currently creating a new site/chan with a group of friends.