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. Link to comment https://forums.phpfreaks.com/topic/18391-resolved-contains/ 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] Link to comment https://forums.phpfreaks.com/topic/18391-resolved-contains/#findComment-79061 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! Link to comment https://forums.phpfreaks.com/topic/18391-resolved-contains/#findComment-79063 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.