If variable equals value php [duplicate]
You are comparing, not assigning: You compare values with == or ===. You assign values with =. You could write less code to achieve the same result too, with a switch statement, or just a bunch of ifs without the elseifs. I would make a function for it, like this: