$arrVariable = array('TOPIC' => array ( 0 => array ('ID' => 'ARTH' ), 1 => array ('ID' => 'KIDS' ), 2 => array ('ID' => 'PAIN' ), 3 => array ('ID' => 'PRNT' ) ) ) ; PHP: i have the above array and my requirement is that i want to have values like arth,kids,pain,prnt in comma seprated form just like using implode. i have tried following code. foreach($arrVariable as $arr){ foreach($arr as $ttt){ foreach($ttt as $k => $v){ $variable .= ','.$v; } } } echo $variable; PHP: which prints ,ARTH,KIDS,PAIN,PRNT. Can someone please help me for any better logic or how to remove first comma...
ohhhh how silly i am i should just use substr to remove that comma. echo $variable=substr($variable,1); thats it!!!!!!!!