Variable $list
stores an array like the one below.
Array
(
[0] => Array
(
[warehouse] => Array
(
[warehouseName] => Warehouse Europe
[warehouseType] => en detail
)
[products] => Array
(
[0] => Array
(
[productName] => APPAREL SHIRTS
[productCode] => 54059761696
[measuringUnit] => buc
[quantity] => 1
)
[1] => Array
(
[productName] => T-SHIRTS - SADAL
[productCode] => 54059764755
[measuringUnit] => buc
[quantity] => 0
)
........... more data ............
Using the following piece of code I print it on the display:
foreach($list as $item) {
foreach($item['products'] as $product) {
$wName = $item['warehouse']['warehouseName'];
$wType = $item['warehouse']['warehouseType'];
$pr =implode(',',$product);
printf("%s,%s,%s".PHP_EOL,$wName,$wType,$pr);
}
}
How can i search if quantity is more than 3, and if it meets the criteria than change it to ">2" before the information is passed to the browser?
Basically i need to keep the quantity confidential and only show ">2" if 3 or more products are retrieved from the array.
Thanks!