Split array with comma?

Asked

Viewed 1,105 times

1

I thus receive the data

Array
(
    [0] => php
    [1] => python
    [2] => javascript
)

how do I receive so comma?

Example:

php, python, javascript 
  • Okay I’ll visualize

  • HI Anderson is not that would like to receive the data with comma

  • Yes, you need only read the replies: https://answall.com/a/88240/5878

  • I actually want him to loop

  • Why if this function does exactly what you need?

  • @Hemersonprestes you do not want with the functions already ready you want with a repetition structure?

Show 1 more comment

1 answer

4


In your case I believe the function implode of PHP already resolves:

string implode ( string $glue , array $pieces )

Example:

<?php

   $array = array('php', 'python', 'javascript');
   $separado_por_virgula = implode(", ", $array);

   print $separado_por_virgula; // php, python, javascript 
  • how will I stay here print_r ($_POST['programming']);

  • I’m sending the data via post

  • So you receive with commas and want to convert to array? That’s it?

  • Please favor existing questions and or answers by clicking on the "Flag" button and indicating a question as duplicate.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.