Can't really understand the logic


i tried this and it works fine my only question is

i get how that bit of code works but i can't really understand the logic

here is what i edited

$a = "c";
if ($a=="a") {
echo "too cold";
} elseif ($a=="b") {
echo "too hot";
} else {
echo "just right";

Unknown error@ Control flow switch 1.Glance at he past

The if statement is commonly referred to as a conditional branch. If condition flow this way; otherwise...

    if condition take this action

    continue flow

Alternately we can take one of two actions...

    if condition take this action

    else take this action

    continue flow

Then we get to multiway branches

    if condition_a take this action

    elseif condition_b take this action
    elseif condition_n take this action

    else take this action

    continue flow


i get it now mostly had to do with what i was putting down

$a =10

if ($a =10 ){
echo "t";

elseif ($a!=10){
echo "f";


// not need it in the condition i set

does this make sense?


This is an else not an elseif. It is either ==10 or it is not.

Consider something along these lines (pseudo code, not PHP syntax)

a = (a random signed float)
if  a < 0 print 'negative'
elseif a > 0 print 'positive'
else print 'zero'

Consider also,

bill = items * price
if bill > some_minimum discount by 10%
else if bill > some_lower_min discount by 5%
else no discount

The else in the above may not be needed, but I cannot remember if PHP can be written without it. Something to look into.