0

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

2 Answers 2

6
$all_users = implode(',',$your_array);
Sign up to request clarification or add additional context in comments.

Comments

1

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;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.