开发者

Help with Array List - PHP MYSQL

I have an array value like this.

My print_r($_POST) looks like this. I can get the post count value too. (Here the count value is 3)

Array ( [tag] => Array ( [4-a] => User1 [8-a] => User2 [3-a] => User3 )) 
开发者_如何转开发

Now, i want the above array values in a single string.

For ex:

$all_users = User1,User2,User3

Is this possible . Pl advice.

Haan


$all_users = implode(',',$your_array);


If i understand your question well...

$array = Array ( 'tag' => Array ( '4-a' => 'User1', '8-a' => 'User2', '3-a' => 'User3' ));
$allUsers = '';
$first = true;

foreach($array['tag'] as $key=>$value) {

  if($first == false) {
    $allUsers .= ',' . $value;
  } else {
    $allUsers .= $value;
  }

  $first = false;

}

echo $allUsers;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜