Today I'm putting together a chart for the "if" control structure. The chart is intended for developers who program in php, vbscript, and javascript. Its easy to get the syntax wrong when you program with all three scripting languages.
"If"
| php | if (condition) { statements; } |
| javascript | if (condition) { statements } |
| vbscript | if (condition) then statement 1 : statement 2
or if (condition) then |
"Else"
| php | if (condition) { statements; } else { statements; } |
| javascript | if (condition) { statements } else { statements } |
| vbscript | if (condition) then statements else statements end if |
"ElseIf"
| php | if (condition) { statements; } elseif (condition 2) { statements; } else { statements; } |
| javascript | elseif not available |
| vbscript | if (condition) then statements elseif (condition 2) then statements else statements end if |
References