Jump to content

lynx2003

New Members
  • Posts

    4
  • Joined

  • Last visited

lynx2003's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm afraid I can't really print my array, and I didn't create the code that it came from so I can't really tell you exactly how it's created as it comes from a lot of different sources, I've tried to figure it out my main issue now is just making a piece of code that takes all of the arrays with the same description key and writes them, however it could even echo them, that would work too, I'm just not sure how to only select the ones with the same description before it restarts the loop to find ones with other descriptions, :\ any help would be great, thanks for your advice up to now
  2. however I'm not really sure how to do that, My idea was to create a regular foreach loop and then try to write all of the ones with the same description in before the loop restarts and the line break is added, any help would be amazing! also thank-you very much for your fast reply!
  3. Well basically my loop writes information to a txt file, the information is stored in an array, however the information in the txt file is seperated by a line break. My aim is to write all of the data in the array with the same $product ['product_description'] into the file, then add the line break
  4. Hey guys, I'm looking for some help using php foreach loops with a php array, basically my loop goes through each array key foreach ($products as $key => $product) { However I don't want the loop to restart until the $product ['product_description'] changes, until then I just want it to keep importing the information as that's what my code is doing, only when the product description changes do I want it to restart the foreach loop, My issue however is I'm not sure how to make it go onto the next array key without restarting the loop as I want all of the keys with the same $product ['product_description'] to keep importing to the same place before the loop restarts as you see I'm very inexperienced using php for loops with arrays, so any help at all would be very much appreciated! Thank-you very much in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.