I'm having difficulties understanding the below code. What does this mean?
if((($weight-0.5)%2)>0 && (($weight-0.5)%2)/2 < 0.25) {
$price=$initial+(($weight-0.5)/2)*$lessthan15kg;
}
This in your if statment
mean ($weight-0.5)%2)>0
--This mean if the remainder
is greater than zero
($weight-0.5)%2)/2 < 0.25
-- This means if you devide remainder
by Two
and its less than 0.25
.
in the middle you got &&
in your if statement
. Thats mean both the condition has to be true(IN other words both condition should be met). than your code will get executed
You can read it as so:
If
The (weight - 0.5) divided by 2 has a left over
and
The half of the left over is less than 0.25
Then
Add the initial price and (weight-0.5)/2 time the price for a small package