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

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -