By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,708 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,708 IT Pros & Developers. It's quick & easy.

help with strpos

P: n/a
say i have the following php script:

<?
if (!is_int(strpos("a","aaa")))
// if (strpos("a","aaa") === false)
print "no match";
else print "match";
?>

when i run it, i am told there is no match, when there actually is.
it doesn't matter which if statement i use (the uncommented out one,
or the commented out one) - i get the same thing. further, if i
change "aaa" to "xxx", it doesn't, all of a sudden, say "match"
(indicating that i would just need to swap the statements) - it
*still* says no match.

so, any ideas as to what's wrong with my code? any help would be
appreciated - thanks :)
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In article <a0**************************@posting.google.com >,
te*******@yahoo.com (yawnmoth) wrote:
say i have the following php script:

<?
if (!is_int(strpos("a","aaa")))
// if (strpos("a","aaa") === false)
print "no match";
else print "match";
?>

when i run it, i am told there is no match, when there actually is.


It should be:

strpos('aaa','a')

int strpos ( string haystack, string needle [, int offset])

<http://nl.php.net/strpos>

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #2

P: n/a
Jan Pieter Kunst <de*****@cauce.org> wrote in message news:<de***************************@news1.news.xs4 all.nl>...
<snip>

It should be:

strpos('aaa','a')

int strpos ( string haystack, string needle [, int offset])

<http://nl.php.net/strpos>

JP


i can't believe i did that, heh. ah well - thanks :)
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.