मान लीजिए निम्नलिखित हमारा सरणी स्ट्रिंग है:
$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