PDA

View Full Version : Is there a way to do this?


Jalrock
12-05-2002, 04:32 PM
Can you have multiple conditions for an if statment? The below ignores both.

if ($action=="selectuser, attack") {

tHE DSS
12-05-2002, 04:35 PM
Use "logical" conditions.

The '&&' = AND
The '||' = OR

... so in your case :


if ($action == "selectuser" || $action =="attack") {
...
...
...
}

Jalrock
12-05-2002, 04:57 PM
Thank You

Xenon
12-05-2002, 07:05 PM
if you have a lot of those conditions this would look better:

if (in_array($action, array("selectuser", "attack"))) {

filburt1
12-05-2002, 07:20 PM
in_array :)

Xenon
12-05-2002, 07:27 PM
thx filburt...

i should type a bit slower next time ;)

Erwin
12-06-2002, 02:21 AM
Nice tips, Xenon. :)

Xenon
12-06-2002, 11:34 AM
thx

it's just an aesthetic tip, but also for modifyinbg and adding new values it's usefull.

i've decided to use this function more often in all my future hacks