note 69254 added to function.parse-str
| From: | PEPE_RIVAS at repixel dot net | Date: | Tue, 29 Aug 2006 01:21:12 +0000 |
| Subject: | note 69254 added to function.parse-str | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116448@lists.php.net to get a copy of this message | ||
CONVERT ANY FORMATTED STRING INTO VARIABLES
I developed a online payment solution for credit cards using a merchant, and this merchant returns
me an answer of the state of the transaction like this:
estado=1,txnid=5555444-8454445-4455554,monto=100.00
to have all that data into variables could be fine for me! so i use str_replace(), the problem is
this function recognizes each group of variables with the & character... and i have comma
separated values... so i replace comma with &
<?php
$string = "estado=1,txnid=5555444-8454445-4455554,monto=100.00";
$string = str_replace(",","&",$string);
parse_str($string);
echo $monto; // outputs 100.00
?>
----
Server IP: 66.163.161.117
Probable Submitter: 200.121.176.59
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.parse-str.php
Edit -- https://master.php.net/note/edit/69254
Del: integrated -- https://master.php.net/note/delete/69254/integrated
Del: useless -- https://master.php.net/note/delete/69254/useless
Del: bad code -- https://master.php.net/note/delete/69254/bad+code
Del: spam -- https://master.php.net/note/delete/69254/spam
Del: non-english -- https://master.php.net/note/delete/69254/non-english
Del: in docs -- https://master.php.net/note/delete/69254/in+docs
Del: other reasons-- https://master.php.net/note/delete/69254
Reject -- https://master.php.net/note/reject/69254
Search -- https://master.php.net/manage/user-notes.php