ধরি আমাদের স্ট্রিং অ্যারেটি আছে −
$full_name= '["John Doe","David Miller","Adam Smith"]';
আমরা আউটপুট চাই একটি সিঙ্গল স্ট্রিং-এ −
John Doe, David Miller, Adam Smith
এজন্য, json_decode() ব্যবহার করুন।
উদাহরণ
PHP কোড নিচে
<!DOCTYPE html> <html> <body> <?php $full_name= '["John Doe","David Miller","Adam Smith"]'; $full_name = json_decode($full_name); $filterData = array_filter(array_map('trim', $full_name)); $output = implode(', ', $filterData); echo "The Result in one string=",$output; ?> </body> </html>আউটপুট
এটি নিচের আউটপুট প্রডিউস করবে
The Result in one string=John Doe, David Miller, Adam Smith