PHP - Array Functions
Identify the error in this PHP code snippet:
$data = ['color' => 'red', 'size' => 'large'];
extract($data);
echo $colour;
$data = ['color' => 'red', 'size' => 'large'];
extract($data);
echo $colour;
extract function creates variables named exactly as the array keys, so it creates $color and $size.$colour which is different from $color, causing an undefined variable notice.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions