Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-03-2005, 06:24 AM   #1
Dusen
Confirmed User
 
Join Date: Aug 2002
Location: East Coast.
Posts: 2,251
PHP Guys - Help

I'm trying to spit out some poor code and am curious if I can improve my method.

In a funciton, I'm searching a string for several different strings. If it is found, I want to return "Found".

$valxx=in_string("variable1",$input);
if ($valxxhahahaha"true") { $returnval="Found"; return($returnval); }

$valxx=in_string("variable2",$input);
if ($valxxhahahaha"true") { $returnval="Found"; return($returnval); }

$valxx=in_string("variable3",$input);
if ($valxxhahahaha"true") { $returnval="Found"; return($returnval); }

$valxx=in_string("variable4",$input);
if ($valxxhahahaha"true") { $returnval="Found"; return($returnval); }


Is there any way I can load the "variable1,variable2" into an array and do it in a single statement?

Thanks
__________________
Penis Pill Sponsor List and Reviews:
http://www.pillsponsors.com
Dusen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-03-2005, 06:35 AM   #2
who
So Fucking Banned
 
Join Date: Aug 2003
Location: ICQ #23642053
Posts: 19,593
can you write it without the 'hahahaha' crap somehow?
who is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-03-2005, 06:36 AM   #3
Ash@phpFX
Confirmed User
 
Join Date: Nov 2003
Posts: 4,292
post your icq
Ash@phpFX is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-03-2005, 06:50 AM   #4
Dusen
Confirmed User
 
Join Date: Aug 2002
Location: East Coast.
Posts: 2,251
The hahah stuff is just '=true' with double equals.

Asher, I hit you up on your ICQ.
__________________
Penis Pill Sponsor List and Reviews:
http://www.pillsponsors.com
Dusen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-03-2005, 06:54 AM   #5
arnette
Confirmed User
 
Join Date: Feb 2005
Posts: 283
Hit me up 243680554
arnette is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-03-2005, 07:12 AM   #6
arnette
Confirmed User
 
Join Date: Feb 2005
Posts: 283
Quote:
Originally Posted by arnette
Hit me up 243680554
Still waiting...
arnette is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-03-2005, 07:38 AM   #7
rvincent
Confirmed User
 
Join Date: Feb 2005
Posts: 431
$input = 'this input contains variable1...';
$array = array('variable1', 'variable2', 'variable3');

if(preg_match('/'.implode('|', $array).'/', $input)) { echo "Found"; }





That is it :-)
rvincent is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.