I have a string like this.
$string = "title1|1.99|www.website.com|www.website.com/img1.jpg|title2|5.99|www.website2.com|www.website2.com/img2.jpg|title3|1.99|www.website3.com|www.website3.com/img3.jpg|";
I wish to explode the string into an array but create a new array every 4 instances of the pipe. also would be nice to name the keys as well like below.
eg:
array (
[title] => title1
[price] => 1.99
[url] => www.website.com
[gallery] => www.website.com/img1.jpg
)
array (
[title] => title2
[price] => 5.99
[url] => www.website2.com
[gallery] => www.website2.com/img2.jpg
)
And so on...
How can I go about achieving this?