Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-16-2006, 06:53 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default finding multiple substrings in a string

how would i go about finding multiple substrings in a string. should i use strpos but how do i more than one? should i use a switch?

i.e.:
PHP Code:
switch($foo)
{
 case strpos($foo, 'bar'):
  do whatever
  break;
 case strpos($foo, 'foo');
  do whatever
  break;
} 
any suggestions
Reply With Quote
  #2  
Old 08-16-2006, 08:18 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why not just an IF for each one ?

PHP Code:
if (strpos($foo, 'bar'))
{ 
  do whatever 
} 
if (strpos($foo, 'foo'))
{ 
  do whatever 
} 
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:16 PM.


Powered by vBulletin® Version 3.9.0
Copyright ©2000 - 2017, vBulletin Solutions Inc.