PHP: concatenation of multidimensional array elements
问题 I want to concatenate one element of a multidimensional array with some strings. <? $string1 = 'dog'; $string2 = array ( 'farm' => array('big'=>'cow', 'small'=>'duck'), 'jungle' => array('big'=>'bear', 'small'=>'fox') ); $string3 = 'cat'; $type = 'farm'; $size = 'big'; $string = "$string1 $string2[$type][$size] $string3"; echo($string); ?> By using this syntax for $string, I get: dog Array[big] cat I would like not to use the alternate syntax $string = $string1 . ' ' . $string2[$type][$size]