Converting a price returned, with only one decimal place.
Hey all,
Long time since i've posted asking for help on the forums!
I've been working on integrating the eBay API into a website I'm building, and all has been going relatively smoothly. Now I'm no PHP guru, i've only really gone feet first in the last couple of years, but I can work my way through the basics. However, I'm a bit stumped this one.
The eBay API returns item prices via XML REST as numbers such as:
£24.95
£24.99
£24.5
So basically when the price would normally end with a 0, it only goes to one decimal place.
The price has been pulled from the XML return and put into a variable so I can manipulate it "$currentPrice".
Anyone have any advice on the best way to add the missing "0" to the returned price?
The important bit of code is below:
PHP Code:
$resp = simplexml_load_file($apicall);
if ($resp->ack == "Success") {
$results = '';
$pagination = '';
foreach($resp->searchResult->item as $item) {
$searchresult = $resp->searchResult;
$currentPrice = $item->sellingStatus->convertedCurrentPrice;
$shippingCost = $item->shippingInfo->shippingServiceCost;
Cheers,
Ant