Intermediate PHP
Q82 / 100

What does PHP's compact() do?

Correct! Well done.

Incorrect.

The correct answer is B) Creates an associative array from variable names and their values

B

Correct Answer

Creates an associative array from variable names and their values

Explanation

$name = "Alice"; $age = 30; compact("name", "age") returns ["name" => "Alice", "age" => 30]. The inverse is extract().

Progress
82/100