asotahu
asotahu

Reputation: 55

convert string array to array php

I have string like this

{"status":"2","holding":"","company":"Company","nik":"8981237","name":"Markonah","ownercard":"Istri"}

how to convert this string to associative array in PHP

Upvotes: 1

Views: 10193

Answers (1)

aidinMC
aidinMC

Reputation: 1436

Its JSON, to convert to array use json_decode():

$string = '{"status":"2","holding":"","company":"Company","nik":"8981237","name":"Markonah","ownercard":"Istri"}';
$my_array = json_decode($string,true);
echo $my_array["status"]; // output: 2

Upvotes: 11

Related Questions