Creating an array of variables

suggest change
$username = 'Hadibut';
$email = 'hadibut@example.org';

$variables = compact('username', 'email');
// $variables is now ['username' => 'Hadibut', 'email' => 'hadibut@example.org']

This method is often used in frameworks to pass an array of variables between two components.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents