Sorry for the bug which I overlooked, the function will run into infinite recursion, so the correct one should look like this.

PHP Code:
 // using a function, and recursively calling it
function print_recurse(&$a)
{
    
printf("%s\n",array_pop($a));
    
// check whether array has any elements, or else it'll become an infinite recursion
    
if(count($a)>0)
        
print_recurse($a);
}

print_recurse($arr);