title: How to pass intergers as values from an array into an IF statement in PHP?
body: <p>What would be the best way to approach the following: </p>
  
  <p>I'm trying to pass values from an array into an IF statement as variables. I would like the statement to loop through every value (in this case a series of integers) in the array and carry out the IF statement. Here's my code so far: </p>
  
  <pre><code>&lt;?php
  
  $con_size = array (35,355,36,37,375,38,385,39,395,40,405,41,415,42,425,43,435,44,445,45,455,46,465,47,475,48,485);
  $arrlength=count($con_size);
  
  for($x=0;$x&lt;$arrlength;$x++) {
  // check if size is available 
  if($line['quantity_c_size_'.$con_size.'_chain'] &gt; 0 ) { 
      ?&gt;
  
      &lt;?=$line['product_id']?&gt;, 
      &lt;?=$line['code_c_size_'.$con_size.'']?&gt;,
  
      &lt;?=$line['title']?&gt;, 
  
      &lt;?=preg_replace('/[^\da-z]/i', ' ', $line['amazon_desc']) ?&gt;,
      &lt;?=$size?&gt;,
      &lt;?=$line['colour']?&gt;,
      &lt;?=$line['material']?&gt;,
      &lt;?=$line['upper']?&gt;,
      &lt;?=$line['lining']?&gt;,
      &lt;?=$line['sole']?&gt;,
      &lt;?=$line['heel']?&gt;,
      &lt;?=$line['material2']?&gt;,
  
      Shoes, 
      UPDATE, 
      &lt;?=$line['shoe_id']?&gt;, 
      http://www.getashoe.co.uk/full/&lt;?=$line['product_id']?&gt;_1.jpg, http://www.getashoe.co.uk/full/&lt;?=$line['product_id']?&gt;_2.jpg,
      http://www.getashoe.co.uk/full/&lt;?=$line['product_id']?&gt;_3.jpg, http://www.getashoe.co.uk/full/&lt;?=$line['product_id']?&gt;_4.jpg,
      &lt;?=$line['price']?&gt;,
      &lt;?=$line['price']?&gt;,
      GBP,
      &lt;?=$line['quantity_c_size_'.$con_size.'_chain']?&gt;,
      A_GEN_NOTAX,
      &lt;?=$line['added_y']?&gt;-&lt;?=$line['added_m']?&gt;-&lt;?=$line['added_d']?&gt;,
      &lt;?=$line['added_y']?&gt;-&lt;?=$line['added_m']?&gt;-&lt;?=$line['added_d']?&gt;,
      ,
      ,
      ,
      ,
      1,
      ,
      ,
      ,
      ,
      2,
      1
  
      &lt;br /&gt;&lt;br /&gt;
      &lt;?
      // finish checking if size is available
      } }
  
      ?&gt;
  </code></pre>
  
  <p>So I would like the value from the array i.e. '35' passing into the IF statement in place of $con_size so that the line will become 'quantity_c_size_35_chain'. </p>
  
  <p>Any help would be appreciated. </p>