在PHP中显示数组的一些简写(但不一定是安全的)方法是什么?

I have tried to do this:

<?=implode(array('A','B','C'));

To display an array but was wondering if there was an easier way of showing an array?

I tried

<?=print_r(array('A','B','C'));

But it actually displays an array structure. I want the string to be like ABC.

No, there is no easier way than this implode.

Normally while debugging array printing is done using implode() and print_r(). If you want to display the arrays in your different way, just create your own function for that.

I have seen in many examples var_dump(...). link text

Yeah, sure... If you always want an array to display, say, with each element on a new line, you can just write your own function (with a really short name... if you are just that lazy... [not recommended...])!

<?php
// To Call Function:
$array = array(2,3,4,5,'awesome!');
ez($array);

/* echoes:
 2
 3
 4
 5
 awesome!
*/

// Poorly named function...
function ez($array = array()) {
    if(!$array || empty($array)) return;
    $output = implode('
',$array);
    echo "<pre>{$output}</pre>";
}
?>

Sorry, this is kind of a smartass answer.