[thelist] Dynamic if statement in PHP

Gustavo Arizpe listas at areaestrategica.com
Tue Oct 22 12:17:01 CDT 2002


Hi all!

I'm struggling with the creatio of what I believe should be called
"dynamic if statement" in php. I don't know if such thing exists.

I have a query string that might have several variables, say from one to
five, not always the same variables, and not always the same number of
variables.

I've managed to put the variable names and values in an array, and I'm
able to generate the conditions depending on the variables I have.

However I cannot modify the if statment depending on the variables I have.

For example if my query string has two variables I want to perform an if
statment similar to this:

if ( condition1 AND condition2)

but if the query string has three variables, then the if statement should
look like this:

if ( condition1 AND conditio2 AND condition3)

I've tried using switch(), case, but it apparently doesn't like it.

Any suggestions?

Thanks a lot in advance.


Gustavo Arizpe
http://www.area.com.mx/estrategica




More information about the thelist mailing list