468,294 Members | 1,834 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,294 developers. It's quick & easy.

help with strpos

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
2 1819
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
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.

Similar topics

9 posts views Thread by Steve | last post: by
reply views Thread by Baby Blue | last post: by
3 posts views Thread by Baby Blue | last post: by
2 posts views Thread by ralphNOSPAM | last post: by
3 posts views Thread by julian_m | last post: by
2 posts views Thread by drec | last post: by
13 posts views Thread by cendrizzi | last post: by
1 post views Thread by Michael Sharman | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.