Article Title
Article body with bold, italic, highlighted,
deleted, inserted, inline code,
HTML,
The Great Book, and Ctrl+S keyboard shortcuts.
Click to expand
Hidden content revealed on expand.
Named entities: © ® ™ € £ ¥ « » … – —
Numeric entities (decimal): © ® €
Numeric entities (hex): © ® €
Article body with bold, italic, highlighted,
deleted, inserted, inline code,
HTML,
The Great Book, and Ctrl+S keyboard shortcuts.
Hidden content revealed on expand.
| ID | Name | Value |
|---|---|---|
| 1 | Alpha | 100 |
| 2 | Beta & Gamma | 200 |
| Total | 300 | |
Version: {$version}, PI: {$pi}
\n"; printf("Formatted: %.2f
\n", $pi); // Heredoc / Nowdoc $heredoc = <<" . htmlspecialchars($nowdoc) . "\n"; // Arrays $fruits = ["apple", "banana", "cherry"]; $assoc = ["name" => "Alice", "age" => 30, "city" => "Berlin"]; $matrix = [[1, 2], [3, 4], [5, 6]]; echo "
Weekday early.
\n"; break; case "Saturday": case "Sunday": echo "Weekend!
\n"; break; default: echo "Midweek.
\n"; } // Match expression (PHP 8+) $status = 2; $label = match($status) { 1 => "Active", 2 => "Pending", 3, 4 => "Inactive", default => "Unknown", }; echo "Status: {$label}
\n"; // Functions function factorial(int $n): int { return $n <= 1 ? 1 : $n * factorial($n - 1); } $closure = static function (float $x, float $y): float { return sqrt($x ** 2 + $y ** 2); }; $arrow = fn($a, $b) => $a + $b; echo "10! = " . factorial(10) . "
\n"; echo "Hypotenuse(3,4) = " . $closure(3.0, 4.0) . "
\n"; // OOP interface Drawable { public function draw(): string; } abstract class Shape implements Drawable { public function __construct(protected string $color = "black") {} abstract public function area(): float; } class Circle extends Shape { public function __construct(private float $radius, string $color = "red") { parent::__construct($color); } public function area(): float { return M_PI * $this->radius ** 2; } public function draw(): string { return "Circle area: " . round($circle->area(), 4) . "
\n"; echo $circle->draw() . "\n"; // Exception handling try { if ($pi > 3) { throw new \InvalidArgumentException("PI is too large for this example!"); } } catch (\InvalidArgumentException $e) { echo "Caught: " . htmlspecialchars($e->getMessage()) . "
\n"; } catch (\Exception $e) { echo "General error: " . htmlspecialchars($e->getMessage()) . "
\n"; } finally { echo "\n"; } // Null safe operator, named arguments $users = [["name" => "Bob", "email" => "bob@example.com"]]; $first = $users[0] ?? null; echo "First user: " . ($first?['name'] ?? "none") . "
\n"; ?> = "Short echo: Today is " . date("Y-m-d") . "
\n" ?>Good morning!
" & vbCrLf ElseIf hour < 18 Then Response.Write "Good afternoon!
" & vbCrLf Else Response.Write "Good evening!
" & vbCrLf End If ' Function in ASP Function FormatPrice(amount) FormatPrice = "$" & FormatNumber(amount, 2) End Function Response.Write "Price: " & FormatPrice(19.99) & "
" & vbCrLf %>" + greeting + "
\n"); Response.Write("Sum of [1..5] = " + sum + "
\n"); // Regex in JScript var emailPattern = /^[\w.-]+@[\w.-]+\.\w{2,}$/; var testEmail = "test@example.com"; Response.Write("Email valid: " + emailPattern.test(testEmail) + "
\n"); %>