kumarappan ramasamy kumarappan ramasamy - 19 days ago 6
PHP Question

How to split comma value in PHP

I have an array in $_POST:

Array ( [tags] => 1,2,3,4,5)


How can i convert this Array into Array like this:

Array ( [tag1] => 1 [tag2] => 2 [tag3] => 3 [tag4] => 4 [tag5] => 5)

Answer

$tags = explode(",", $_POST['tags']); print_r($tags);

Array (
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
)
Comments