Roi Patrick Florentino Roi Patrick Florentino - 9 months ago 44
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


Try with this:

$input = 'data={"table":"users","fname":"mil","lname":"minoza","cntct":"09876543212"}';
$data = str_replace('data=', $input);
$data = json_decode(input , true);