how to remove curly braces from a given string i have apply to all the matches to change the string.
my output look like this is
{"Category":"TATA Wiron TW02","Quantity":"33 Kgs","Total Price":"4125"},{"Category":"Tata Wiron Aayush","Quantity":"33 Kgs","Total Price":"3630"}
then i will change that this type
Category:TATA Wiron TW02,Quantity:33 Kgs,Total Price:4125},{Category:Tata Wiron Aayush,Quantity:33 Kgs,Total Price:3630
but here i have get the problem is Total Price:4125},{Category:Tata Wiron Aayush
in this two items we make but dynamically so many items will be added how to remove it
my Code is:
<?php
session_start();
$out = $_SESSION["output"];
echo $out;
$data = preg_replace("/\{[^}]+\}/", "", $out);
$msg = trim($out, '{},');
$msg2 = trim($msg, '"');
$msg3= str_replace('"','',$msg2);
echo $msg3;
?>
how to remove curly braces from a given string i have apply to all the matches to change the string.
my output look like this is
{"Category":"TATA Wiron TW02","Quantity":"33 Kgs","Total Price":"4125"},{"Category":"Tata Wiron Aayush","Quantity":"33 Kgs","Total Price":"3630"}
then i will change that this type
Category:TATA Wiron TW02,Quantity:33 Kgs,Total Price:4125},{Category:Tata Wiron Aayush,Quantity:33 Kgs,Total Price:3630
but here i have get the problem is Total Price:4125},{Category:Tata Wiron Aayush
in this two items we make but dynamically so many items will be added how to remove it
my Code is:
<?php
session_start();
$out = $_SESSION["output"];
echo $out;
$data = preg_replace("/\{[^}]+\}/", "", $out);
$msg = trim($out, '{},');
$msg2 = trim($msg, '"');
$msg3= str_replace('"','',$msg2);
echo $msg3;
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.