Добрый день. Имеется следующий массив:
Array
(
[ItemID] => 1000116795
[PartNumber] => QD450
[Producer] => FSP
[ItemName] => QDION ATX 450W, 120mm, 5xSATA, 1xPCI-E, nonPFC
[ItemNameRus] => Блок питания 450Вт
[CategoryID] => V0213
[CategoryNewID] => V0213
[Price] => 25.000000000000
[Currency] => USD
[PriceUSD] => 25.000000000000
[PriceRUR] => 1599.870000000000
[DiscountB2B] => 0.000000000000
[PercentConv] => 0.000000000000
[PriceStartDate] => 2019-06-20T00:00:00+03:00
[Availability] => 1
[Multiplicity] => 1
[PriceEndUser] => Array
(
)
[PriceEndUserWeb] => Array
(
)
[PriceEndUserKeeping] => 0
[UOM] => шт
[Weight] => 1.055000000000
[Width] => 0.150000000000
[Height] => 0.090000000000
[Depth] => 0.140000000000
[Volume] => 0.001890000000
[EquipmentGroup] => Комплектующие для ПК
[EquipmentType] => Блоки питания
[Comment] => Array
(
)
[Locations] => Array
(
[QuantityLocation] => Array
(
[0] => Array
(
[Location] => Москва
[Quantity] => 300
[GreaterThanQuantity] => 1
)
[1] => Array
(
[Location] => Санкт-Петербург
[Quantity] => 300
[GreaterThanQuantity] => 1
)
)
)
)
Вопрос - как для каждого элемента такого массива применить функцию trim, то бишь в каждом элементе массиве убрать проблемы в начале и конце?
Код для вывода данного массива:
$login = "***";
$token = "***";
function ocs($method, $params) {
$xmlfile = file_get_contents("https://b2bservice.ocs.ru/b2bjson.asmx/".$method."?".http_build_query($params));
$xml = simplexml_load_string($xmlfile);
$json = json_encode($xml);
$xmlArr = json_decode($json, true);
return $xmlArr;
}
$gpParams = array(
'Login' => $login,
'Token' => $token,
'Availability' => 0,
'ShipmentCity' => '',
'CategoryIDList' => 'V0213',
'ItemIDList' => '',
'LocationList' => '',
'DisplayMissing' => 1,
);
$getProducts = array("0" => ocs("GetProductAvailability", $gpParams)["Products"]["Product"][4]);