Roi Patrick Florentino Roi Patrick Florentino - 1 year ago 103
PHP Question

Convert a string into a specified array using php

How can I convert into an array into a specified array to be exact.
Here's my string


What I'm trying to achieve is something like this..

Array (
[table] => users
[fname] => mil
[lname] => minoza
[cntct] => 09876543212

Answer Source

Try with this:

$input = 'data={"table":"users","fname":"mil","lname":"minoza","cntct":"09876543212"}';
$data = str_replace('data=', $input);
$data = json_decode(input , true);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download