Re: [PHP] function for finding one character in a string?
Or, if you want a count of the number of times a character (or string if you want) ocurrs in a string, you could use: substr_count() http://www.php.net/manual/en/function.substr-count.php Adam Voigt [EMAIL PROTECTED] On Tue, 2002-07-16 at 17:36, Scott Fletcher wrote: > I have been looking around in the PHP function listing for a function that > can find or match one character from a string. I thought it would be > something like post_str() or something but never found anything close to > that. I get the idea of post and str from the SQL command. I did check the > ereg() but it is so confusing, no clear instruction on it. > > --clip-- > $str = ""; > $str = "X"; > $str = "XY" > $str = "Y"; > $str = "YX"; > --clip-- > > Those same variables from above, I only need to know if hte "X" exist in the > string, nothing else. > > Thanks, > FletchSOD > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function for finding one character in a string?
On Wednesday 17 July 2002 05:36, Scott Fletcher wrote: > I have been looking around in the PHP function listing for a function that > can find or match one character from a string. I thought it would be > something like post_str() or something but never found anything close to > that. I get the idea of post and str from the SQL command. I did check > the ereg() but it is so confusing, no clear instruction on it. > > --clip-- > $str = ""; > $str = "X"; > $str = "XY" > $str = "Y"; > $str = "YX"; > --clip-- > > Those same variables from above, I only need to know if hte "X" exist in > the string, nothing else. strstr() -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "Think of it this way: threads are like salt, not like pasta. You like salt, I like salt, we all like salt. But we eat more pasta." - Larry McVoy */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function for finding one character in a string?
I have been looking around in the PHP function listing for a function that can find or match one character from a string. I thought it would be something like post_str() or something but never found anything close to that. I get the idea of post and str from the SQL command. I did check the ereg() but it is so confusing, no clear instruction on it. --clip-- $str = ""; $str = "X"; $str = "XY" $str = "Y"; $str = "YX"; --clip-- Those same variables from above, I only need to know if hte "X" exist in the string, nothing else. Thanks, FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php