How can I take an array with individual strings but also comma separated strings and explode the comma separated items into individual items? For instance:
while(($row = mysql_fetch_array($downloads_query))) {
$product_array[] = $row['product'];
}
$product_array[] returns:
item 1: "10003"
item 2: "10016"
item 3: "10008, 10007, 10010"
How can I split item 3 into individual items 3, 4 and 5 so that $product_array returns:
item 1: "10003"
item 2: "10016"
item 3: "10008"
item 4: "10007"
item 5: "10010"
mysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.explode. But I am not sure how to implement it because doesn'texplodereturn another array? Would I simply iterate over the exploded array andpushto the original array? I assume there's a more elegant solution?