Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   if in (http://www.programmingforums.org/showthread.php?t=11907)

commodore Nov 16th, 2006 3:19 PM

if in
 
I can do this in python:

if "asdf" in list:
do stuff

Can I do something like that to an associative array in PHP?

Jimbo Nov 16th, 2006 3:25 PM

You can use the in_array() to see if the value exists, and if you're looking for a key then you could probably combine that with array_keys()

commodore Nov 17th, 2006 1:01 PM

Thanks Jimbo! But there's no generic if in like thing?

Pizentios Nov 17th, 2006 1:06 PM

you might want to look at switches. see this link for more information.

Eryk Nov 19th, 2006 2:07 PM

Quote:

Originally Posted by commodore (Post 119150)
Thanks Jimbo! But there's no generic if in like thing?

No there isn't, Python has many features that aren't available in other languages.


All times are GMT -5. The time now is 1:37 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC