On 16/03/2011, at 10:34 AM, Jack wrote:
> Hello All,
>
>
>
> I got some help on this yesterday, but somehow it's not consistant
>
>
>
> <?
>
>
>
> $results = "3434approd34";
>
>
>
> if(strpos($results['response'], 'APPROVED') !== false) {
>
>
>
> print "declined";
>
>
>
> } else {
>
>
>
> print "approved";
>
> }
>
>
>
> ?>
>
>
>
>
>
> The thing is I cant get a consistant response, if it has approved anywhere
> in the results string, then it should be approved and if the results is
> APPROVD without the E it shold be delined.
>
>
>
> Am I doing something wrong.
>
>
>
>
>
> Thanks!
>
> Jack
Yes, you're doing something wrong. strpos() returns false if it can't find the
needle. You should be using if(strpos() === false) { declined; }
---
Simon Welsh
Admin of http://simon.geek.nz/
Who said Microsoft never created a bug-free program? The blue screen never,
ever crashes!
http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php