PHP Bug Hunt Easy +10 XP
Undefined Index
This causes a PHP notice/warning.
PHPFind the bug
1
$data = ["name" => "Alice"];2
echo $data["email"]; The bug is on line 2
Select the correct fix
Show answer and explanation
Answer: Both A and B fix it
Accessing a non-existent array key triggers an undefined index notice. Use isset() or ?? to provide a safe fallback.
Hint: 'email' key doesn't exist in $data.
What this challenge tests
Bug Hunt in PHP: arrays, undefined-index.