Wednesday, 15 April 2015

php - how to input elements instead of another array, into end of array? -


Due to poor DB designs, the columns in each row can have multiple values ​​in the table. So I had to take every string, check if comma exists (multiple values) & amp; Place each element at the end of an array.

Try a function like struts, blast, array_push etc. With the Folllowing Code, how many elements do I input at the end of the array without any other & amp; By placing in an existing array?

  $ test = array (); $ Test = array ("test"); $ Str = 'a, b, c, d'; $ Parts = explosion (',', $ str); Array_push ($ test, $ portion); // Another array that was inserted in the $ test, which I do not want print_r ($ test); Use  

array_merge.

  $ test = array_merge ($ test, $ parts);  

Example:


No comments:

Post a Comment