Re: String eval assistance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 15, 2011 at 17:34, Jack <JackListMail@xxxxxxxxx> wrote:
> Hello All,
>
>
>
> I got some help on this yesterday, but somehow it's not consistant
>
>
>
> <?

    For compatibility, you shouldn't use short_open_tags.


> $results = "3434approd34";

    Here you're defining the variable as a string.

> if(strpos($results['response'], 'APPROVED') !== false) {

    Here you're trying to access it as an array, which it's not, so
the 'response' key doesn't exist.  In addition, you're looking for
UPPER-CASE, whereas that's not the case in your example variable.
Finally, you're checking to make sure that the string IS INDEED found,
but then printing that it was declined (!== false).  Instead, you may
want:

<?php

$results['response'] = '3434approd34';

if (stripos($results['response'],'APPROVED') !== false) {
    // It's been found
} else {
    // Oh, crap.
}

?>

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux