When I use Smart::Comments in Perl, I can see the name of the hash I am dumping (i.e. %person, below). . .
[pdurbin@macbook ~]$ cat /tmp/person.pl
#!/usr/bin/perl
use strict;
use warnings;
use Smart::Comments;
my %person = (
'hair' => 'golden',
'eyes' => 'blue',
);
### %person
[pdurbin@macbook ~]$ perl /tmp/person.pl
### %person: {
### eyes => 'blue',
### hair => 'golden'
### }
[pdurbin@macbook ~]$
. . . but in PHP I only see "Array", no mention of $person. . .
[pdurbin@macbook ~]$ cat /tmp/person.php
<?php
$person = array(
'hair' => 'golden',
'eyes' => 'blue',
);
print_r($person);
[pdurbin@macbook ~]$ php /tmp/person.php
Array
(
[hair] => golden
[eyes] => blue
)
[pdurbin@macbook ~]$
I've tried print_r(), var_export(), and var_dump() but is there some other PHP function that will print the name of an array with its contents?