title: PHP: split string based on array
body: <p>Below is that data I'm trying to parse:</p>
  
  <pre><code>50‐59 1High300.00 Avg300.00
  90‐99 11High222.00 Avg188.73
  120‐1293High204.00 Avg169.33
  </code></pre>
  
  <p>The first section is a <em>weight range</em>, next is a <em>count</em>, followed by <em>Highprice</em>, ending with <em>Avgprice</em>.</p>
  
  <p>As an example, I need to parse the data above into an array which would look like</p>
  
  <pre><code>[0]50-59
  [1]1
  [2]High300.00
  [3]Avg300.00
  
  [0]90-99
  [1]11
  [2]High222.00
  [3]Avg188.73
  
  [0]120‐129
  [1]3
  [2]High204.00
  [3]Avg169.33
  </code></pre>
  
  <p>I thought about creating an array of what the possible weight ranges can be but I can't figure out how to use the values of the array to split the string.</p>
  
  <pre><code>$arr = array("10-19","20-29","30-39","40-49","50-59","60-69","70-79","80-89","90-99","100-109","110-119","120-129","130-139","140-149","150-159","160-169","170-179","180-189","190-199","200-209","210-219","220-229","230-239","240-249","250-259","260-269","270-279","280-289","290-299","300-309");
  </code></pre>
  
  <p>Any ideas would be greatly appreciated.</p>