![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
So Fucking Banned
Join Date: Aug 2003
Location: ICQ #23642053
Posts: 19,593
|
can you write it without the 'hahahaha' crap somehow?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Nov 2003
Posts: 4,292
|
post your icq
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Feb 2005
Posts: 283
|
Hit me up 243680554
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Confirmed User
Join Date: Feb 2005
Posts: 283
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
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 :-) |
![]() |
![]() ![]() ![]() ![]() ![]() |