= 18) ? 'Yes' : 'No' // Alternatively, you could write the above like this, but the above saves lines of code. if ($age >= 18) { $can_vote = 'Yes'; } else { $can_vote = 'No'; } // ----------------------------- // Switch statements // ----------------------------- // E.g. switch ($isOlympicYear) { case 2023: break; // Without a break, the code will continue executing to the next case. case 2024: break; case 2025: break; default: // Default is the equivalent to an ELSE break; } // Using a switch like above instead of the following if ($year === 2023) { // } elseif ($year === 2024) { // } elseif ($year === 2025) { // } // ----------------------------- // For loops // ----------------------------- // E.g. for ($i = 1; $i < 5; $i++) { echo "This is the $i -th iteration."; } // ----------------------------- // While loops // ----------------------------- // E.g. $i = 1; while ($i < 5) { echo "This is the $i -th iteration."; $i++; } // ----------------------------- // Passing Arguments by Reference // ----------------------------- function add_five(&$value) { $value += 5; } $num = 2; add_five($num); echo $num; // Outputs: 7 // ----------------------------- // Using the ... operator // - Allows for any number of arguments // ----------------------------- function sum(...$numbers) { $sum = 0; for ($i = 0; $i < count($numbers); $i++) { $sum += $numbers[$i]; } return $sum; } echo sum(1, 2, 3, 4); // Output: 10