A.1. Comments
A.1.1. Comments
PHP
// Single-line comment /* Multi-line comment */
ASP/VBScript
' Single-line comment
ASP.NET/C#
// Single-line comment /* Multi-line comment */
JSP/Java
// Single-line comment /* Multi-line comment */
A.1.2. Variable Typing
PHP
Loose
ASP/VBScript
Loose
ASP.NET/C#
Strong
JSP/Java
Strong
A.1.3. Variable Declaration
PHP
$variable = value;
ASP/VBScript
Dim variable
ASP.NET/C#
type variable;
JSP/Java
type variable;
A.1.4. Constant Declaration
PHP
define('NAME', value);
ASP/VBScript
Const name = value
ASP.NET/C#
const type name = value;
JSP/Java
visibility final type = value;
A.1.5. Creating Arrays
PHP
$name = array(elem1, elem2, elem3); $name = array('key1' => elem1, 'key2' => elem2, 'key3' => elem3);
ASP/VBScript
Dim name(length)
ASP.NET/C#
type[] name = new type[length];
JSP/Java
type[] name = new type[length];
A.1.6. Referencing Array Elements
PHP
$name[index] $name['key']
ASP/VBScript
name(index)
ASP.NET/C#
name[index]
JSP/Java
name[index]
A.1.7. Conditional Evaluation
PHP
if (condition) { ... } elseif (condition) { ... } else { ... }
ASP/VBScript
If condition Then ... ElseIf condition Then ... Else ... End If
ASP.NET/C#
if (condition) { ... } else if (condition) { ... } else { ... }
JSP/Java
if (condition) { ... } else if (condition) { ... } else { ... }
A.1.8. Multiple-Choice Selection
PHP
switch (expr) { case value1: ... break; case value2: ... break; default: ... }
ASP/VBScript
Select Case expr Case value1 ... Case value2 ... Case Else ...
Get Professional LAMP: Linux®, Apache, MySQL®, and PHP5 Web Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.