easy way to chek if string contains "?" HOW?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

easy way to chek if string contains "?" HOW?

Post by alexus »

Hi,
Basically I want to find out if the REQUESTED_URI contains any variables, so I want to see if it has "?" in it.
I got it working w/ foreach() method, but it a bit to slow for some reason, and I dont really need to cycle thwough full string... is there any easier method?


Thnx!
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

strpos()
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I think you can also check against $REQUEST['QUERY_STRING'], but it might not be reliable. For sure, strpos() will tell you if there is a '?' in the string, as long as you tell it the right string to check.
Post Reply