$prices = [12000, 51600, 700, 10];
$sale = 40;
function pricesWithSale($sale, $prices) {
foreach($prices as $key => $price) {
$prices[$key] = ($price * $sale) / 100;
}
}
pricesWithSale($sale, $prices);
var_dump($prices);
function pricesWithSale($sale, &$prices) {
foreach($prices as $key => $price) {
$prices[$key] = ($price * $sale) / 100;
}
}