PHP: Dump values of multiple variables
21 September 2024 (Updated 21 September 2024)
<?php
$name = 'John doe';
$age = 42;
$location = 'Singapore';
print_r(compact('name', 'age', 'location'));
Output:
Array
(
[name] => John doe
[age] => 42
[location] => Singapore
)
Tagged:
PHP