php - break array as a string -



php - break array as a string -

i have array:-

array ( [6] => 1 [6(hl)] => 3 [5] => 1 [7(hl)] => 2 )

how break , echo this:-

2(6), 3(6(hl)), 1(5), 2(7(hl))

i have seek utilize implode break string, result get:-

2, 3, 1, 2

any thought on this?

thanks advance.

assume array $arr :

$output = ''; foreach($arr $k => $v) { $output .= $v . '(' . $k . ')' . ', '; } $output = substr($output, 0, strlen($output)-2); echo $output;

php arrays

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -