In PHP, default values are assigned using the equals sign inside the function parameter list.
Step 2: Check each option
function greet($name = "Guest") { echo "Hello, $name!"; } uses correct syntax: $name = "Guest" inside parentheses. Syntaxes using = after the closing parenthesis or colon (:) are invalid. function greet($name) { $name = "Guest"; echo "Hello, $name!"; } assigns default inside the function body, not as a parameter default.
Final Answer:
function greet($name = "Guest") { echo "Hello, $name!"; } -> Option A
Quick Check:
Default parameter = equals sign in parentheses [OK]
Quick Trick:Use = inside parentheses to set default values [OK]
Common Mistakes:
Using colon or other symbols instead of =
Assigning default inside function body instead of parameter list
Placing default value outside parentheses
Master "Functions" in PHP
9 interactive learning modes - each teaches the same concept differently