<?php
//SOF - this is just a refference point.
//lets assign some values to begin with, notice that you can assign a variable to a variable,
//this meens that same value wil be held in both.
$a = 1;
$b = 2;
$c = 4;
$e = $c;
$start = 'here';
$end = 'there';
$distance = '10';
//ok, new we have some values assigned we can start playing with them :
$result = (($a * $b) / (($c - $b) + 94));
//in the above line you can see that, just as in mathematics, parenthesis () can be used to
//force the order that parts of a complex calculation are performed.
//now well look at doing some comparison. To do a compare you need to use whats called a
//conditional statement. Either an if, a for or a while. as Both for and while are
//actualy loops that perform conditional checks well stick with an if first of all.
//Have a look at the if and how it's built, but don't worry if it doesn't make sense,
//we'll be coming back to them later, our focus just now is what's between the ().
if ($result >= $e){
$status = 'Is greater than or equal to';
}
elseif($result <= $e){
$status = 'Is less than or equal to';
}
else{
$status = 'Mathatmatical impossibility encountered. Cool.';
}
//next were going to play with a while loop, again, don't worry if you don't get the
//while looping thing, were only paying for the operators just now, so feel free to
//leave the loops at the side of your plate if you don't like them.
$travels = ''; //we can assign nothing to a variable as well as a value
while ($distance >= 1){
$travels .= "$start is not $end, there is still $distance more miles to go.<br>";
//what's that? An operator I didn't tell you about? Sneeky huh? We'll get to it, don't worry
// I was just making sure your paying attention.
$distance--;
}
if ($distance == 0){
$travels .= "$start is $end, because there is $distance more miles to go.<br>";
}
//EOF - just another refference point
?>