![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
|
| Plugged In Online Gaming, and Technology |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| I Am The Admin | I need a PHP if expression on finding a string... OK... I'm trying to find a few letters in a word. Example: $word = myword Now lets say I want to find "ord" in that string or word In perl is use: if ($word =~ "ord") { blah... } if PHP is use??? I know it's ereg (or I think it is) in PHP, but I can't seem to make it work. if (ereg('[ord]',$word)) { blah... } Any php masters around here?
__________________ Focal point of a distant gaze MCB Rules - Please Read them MySpace.com/painthappy - MySpace Blog PM me or Email me if you have tips, paintball news, or press releases. |
| | |
| | #2 (permalink) |
| Seasoned Member | strpos() should be simple enough for you. *edit...didn't mean it like that. I meant approach...... PHP: strpos - Manual |
| | |
| | #3 (permalink) |
| MCB Member Join Date: Mar 2006 | I think you just need to drop the brackets from your code. "[ab]": matches a string that has either an a or a b (that's the same as "a|b"); -MR |
| | |
| | #4 (permalink) |
| I Am The Admin | Hey DarkStar... Thanks... That was all I needed. Just dropped the [] and it worked. Excellent. Carter
__________________ Focal point of a distant gaze MCB Rules - Please Read them MySpace.com/painthappy - MySpace Blog PM me or Email me if you have tips, paintball news, or press releases. |
| | |
![]() |
|
| Thread Tools | |
|
|