我怎么能在PHP中拆分价值?

I have this value like this in PHP file :

{First=itema,Fourth=10000.0,Second=10,Third=1000},{First=itemb,Fourth=12000.0,Second=12,Third=1000}

How can I split this values 'till I get values like this :

{itema,10000,10,100} AND {itemb,12000,12,1000}

I got that value from method POST in my android apps and I get in my PHP file like this :

<?php


$str = str_replace(array('[',']'), '', $_POST['value1']);
$str = preg_replace('/\s+/', '', $str);

echo $str;

?>

And, this is my code in android apps :

try {

            httpclient = new DefaultHttpClient();
            httppost = new HttpPost("http://192.168.107.87/final-sis/order.php");

            nameValuePairs = new ArrayList<NameValuePair>(2);

            nameValuePairs.add(new BasicNameValuePair("value1", list.toString()));

            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            response=httpclient.execute(httppost);
            Log.d("Value Price: ", httppost.toString());
            HttpEntity entity=response.getEntity();
            feedback = EntityUtils.toString(entity).trim();
            Log.d("FeedBack", feedback);

        }catch (Exception e){

        }

This is link about my code completely :

How can I store my ArrayList values to MySQL databases??

I have been asking before but I couldn't found best way.

Thank you.

This will produce the desired string. I use some regular expressions first to split the initial string and then to grab each value.

$s = '{First=itema,Fourth=10000.0,Second=10,Third=1000},{First=itemb,Fourth=12000.0,Second=12,Third=1000}';

preg_match_all('/\{[^}]*}/', $s, $m);

At this point $m contains:

array(1) {
  [0]=>
  array(2) {
    [0]=>
    string(49) "{First=itema,Fourth=10000.0,Second=10,Third=1000}"
    [1]=>
    string(49) "{First=itemb,Fourth=12000.0,Second=12,Third=1000}"
  }
}

Then we loop each part. The next regex:

'/\=([^\,]+)/'

This says, grab all the text that is in between an equals sign and a comma and put it into a capturing group.

Then we just implode the matches.

$parts = array();
foreach($m[0] as $match) {
   $t = trim($match, '{}');
   preg_match_all('/\=([^\,]+)/', $t, $m2);
   $parts[] = '{'.implode($m2[1], ',').'}';
}

$finalString = implode($parts, ' AND ');
var_dump($finalString);