daxguy Posted January 15, 2011 Share Posted January 15, 2011 I am trying to find a character in the follwing string $string = ' Mumbai Mast Kallander - 02 - Mumbai Mast Kallander'; the character i want to find is '-' and the find how many times does it occur in the string.. can anyone help? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 15, 2011 Share Posted January 15, 2011 What do you mean by "find it"? If you just want to know if it occurs, and how many times, you can use substr_count for that. Quote Link to comment Share on other sites More sharing options...
Zurev Posted January 15, 2011 Share Posted January 15, 2011 What do you mean by "find it"? If you just want to know if it occurs, and how many times, you can use substr_count for that. I think you want to use explode just from what I think you're trying to do.... list($series, $episode, $title) = explode(" - ", $string); echo $series; // Mumbai Mast Kallander echo $episode; // 02 echo $title; // Mumbai Mast Kallander 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.