Dear Weedpacket, richie, thanks a million for your feedback, I have learned lots this weekend. Ritchie, I never knew of the list construct, excellent. I ended up only needing one loop of the string to get the total price value, here is the code for anyone else who may be interested:
$break1 = explode('|', $cart);
for ($i=0; $i< count ($break1); $i++)
{
if(strpos($break1[$i], 'Price=')!==false)
{
list(,$numval) = explode("=", $break1[$i]);
$record_array[] = $numval;
}
}
$total_price = array_sum($record_array);
echo $total_price;
PS: I play with PHP for fun when I get time, not as a living, so perhaps stating that I should pay someone when looking advice on a FORUM may be a little harsh. Being a designer, the best way I learn is from looking at others code as I find it difficult to attempt something like the above from scratch at present. Even with the small snippet on actually manipulating a string, Im sure you appreciate it does not have commercial value. My cart evolved from learing about PHP sessions to a tutorial I wanted to tweak, then got totally lost as I was useless at arrays.
All part of the fun. Thanks for the help guys,a s I said, learned lots from your examples