RE: [PHP] String eval assistance

From: Date: Wed, 16 Mar 2011 00:25:30 +0000
Subject: RE: [PHP] String eval assistance
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-311882@lists.php.net to get a copy of this message
> 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. > } > > ?> maybe I should do this some other way because I'm getting false positives. I was using if(strpos($results['response'], 'APPROVED') !== false) { And its found if the value of $results = "3434APPROVED34" and it also is found if its $results = "3434APPOVED34", so this may not be the best way to accomplish this.

« previous php.general (#311882) next »