Php Loop Over Key Value Array Javascript Length Function In Perl