Outputting the else no matter if it's met or not --


Would love any ideas about what is wrong with my code - I thought it would output "you are ok" because i set the name to Stephen...but it still outputted the echo for Tom. Any ideas?

$name = "stephen";
if ($name = "tom") {
echo "you are cool";
elseif ($name = "stephen") {
echo "you are ok";
else {
echo "not your lucky day";


I don't know php but I assume the = sign is for assignments, and not for comparisons.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.