title: Trying to separate file name to prefixes after listing all files in a folder
body: <pre><code>&lt;?
  $count = 0;
  foreach (glob("images/shop/products/*.*") as $filename)
  {
      $count++;
      $files[] = $filename;
  }
  foreach ($files as $filename)
  {
  echo $filename;
  
  }
  ?&gt;
  </code></pre>
  
  <p>This lovely script will output all files names in the specific images folder,
  My issue right now is figuring out how to make it pull out parts of the file name, and write it (as prefixes)</p>
  
  <p>Files in the folders are named like this:
  category_name_price.jpg</p>
  
  <p>why .jpg? because the file itself is an image and my goal is to list all the images as a quick category that shows prices below each image, but also to have it organized right.</p>
  
  <p>so for example:
  shampoo_DoveCleaner_15.jpg
  or also:
  bodysoap_SpecialMineral_10.jpg</p>
  
  <p>I plan on exploding the .jpg part and only include it in the img src tags of each product picture.</p>
  
  <p>I know this might cause problems with spaces when for example i will need a longer name for the product (Head and Shoulders) but i will find a solution to that later on, I guess (if anyone see a possible quick fix for that, that will be awesome!)</p>
  
  <p>eventually, I need to have prefix for each part
  $cat,$name,price
  so that I can organize the whole box right.</p>
  
  <p>I apologize for asking here, I am not a php guru but I will appreciate any help. I tried different methods but nothing seems to fit what i'm trying to do.</p>
  
  <p>Thank you all in advance !</p>