I know that it is possible to nest ternary operators, and I want to use them in this case to save time (at least in the future).
I have a variable that will hold one of four values:
- "admin"
- "edit"
- "wadmin"
- "wuser"
Each of these is used to determine necessary password lengths based on the user type, 16, 12, 8, and 8, respectively.
I want PHP to echo each of those numbers based on the contents of the variable, in this case named $match
What I have so far is this:
echo $match == "admin" ? "16" : $match == "edit" ? "12" : "8";
But this always echoes 12. How can I rewrite this to properly echo "16", "12", or "8"?