You want to know that the clear concept of json_encode and json_decode process. In PHP, json_encode() and json_decode() is used to convert PHP supported data type into JSON formatted.
If your json_encode data will this then what to do you? Follow below code.
Json Encode:
{"type":"vendor","id":"55"}
Json Decode:
<?php $added_byjson=json_decode($row['added_by']); ?>
Output will be like that:
<?php array ( 'type' => 'vendor', 'id' => '55', ) ?>
Print string value:
<?php $added_by=$added_byjson->type; ?>
Output: vendor
Question and answer is powered by AnsPress.io