Create an array from variables and their values:

$firstname = "Peter";
$lastname = "Griffin";
$age = "41";

$result = compact("firstname", "lastname", "age");

print_r($result);
by გიორგი ბაკაშვილი
4 years ago
PHP
PHP official doc
2
Pro tip: use ```triple backticks around text``` to write in code fences