gerkintrigg Posted August 23, 2006 Share Posted August 23, 2006 Hi!I wondered what the best function, command line (or whatever else you want to call it) I should use to determine if a string contains another string.so for example I need to know what the "contains" below needs to be changed to:[code]<?php if ($string_1 contains $string_2){//do something;}?>[/code]Thanks for your help. Quote Link to comment Share on other sites More sharing options...
trq Posted August 23, 2006 Share Posted August 23, 2006 [code=php:0]$a = "thisisfoo";$b = "foo";if (strstr($a,$b)) { echo $b." found in ".$a;}[/code] Quote Link to comment Share on other sites More sharing options...
gerkintrigg Posted August 23, 2006 Author Share Posted August 23, 2006 Nice and easy..Thanks very much.I wan't sure what to search for on php.net, but I'll not be forgetting that! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.