How do I print the values in PHP, which are stored in array format in MySQL with the same name calle
Coding Tips Public
[Sep-24-2019]

How do I print the values in PHP, which are stored in array format in MySQL with the same name calle

How do I print the values in PHP, which are stored in array format in MySQL with the same name calle

We can use implode function like the below..

echo implode(',',array_column(json_decode($json_str,true),'value'));

json_decode — Decodes a JSON string

array_column — Return the values from a single column in the input array

implode — Join array elements with a string

Note:- When TRUE, returned objects will be converted into associative arrays.

Demo: https://3v4l.org/XhiBZ

Output:-

css,html,javascript,just a samplepost


   


Login to Comment


Share your thoughts