SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: If variable contains
Hybrid View
-
Apr 30, 2005, 16:02 #1
- Join Date
- Nov 2003
- Location
- Watervliet, mi
- Posts
- 651
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If variable contains
I want to only do something if a variable contains the text:
Logfile of HijackThis
There will be quite a bit of text bother before and after this but I can't think of the function to search through a variable LOL It's been a while since I did any coding so I've forgotten pretty much everything
-
Apr 30, 2005, 16:07 #2
- Join Date
- Apr 2003
- Location
- PA
- Posts
- 518
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Here's one way:
PHP Code:if (strpos($string, 'Logfile of HijackThis') !== FALSE) {
echo '"Logfile of HijackThis" found!';
}
Last edited by Haleden; Apr 30, 2005 at 16:07. Reason: Cleaning it up
-
Apr 30, 2005, 16:26 #3
- Join Date
- Nov 2003
- Location
- Watervliet, mi
- Posts
- 651
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thanks, that's working great
I've had over 40k submissions in the past 2mnths to a system and doing stuff like this will help automate the process for filtering out the junk. The system I'm adding this to is http://hjt.iamnotageek.com/ if you're wondering. I haven't had any time for programming in a while so I've forgotten alot LOL
-
Apr 30, 2005, 17:55 #4
- Join Date
- May 2004
- Location
- Ontario, Canada
- Posts
- 99
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Also, an alternative to this you can use regular expression functions such as preg_match() but, if you've been away from PHP for a while, don't worry about it
Brock Ferguson
Lead Developer, Caribou CMS
A Subscription/Membership CMS and Ecommerce Platform - FREE Trial
Bookmarks