title: If statement within an array declaration ...is that possible?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4118875/a-conditional-element-inside-an-array-construct">A conditional element inside an array(&hellip;) construct</a>  </p>
  </blockquote>
  
  
  
  <p>Here is my code </p>
  
  <pre><code>$product_option_value_data[] = array(
      'product_option_value_id' =&gt; $product_option_value['product_option_value_id'],
      if (isset($product_option_value_description_query-&gt;row['smallimage'])) {
          'smallimage'                  =&gt; $product_option_value_description_query-&gt;row['smallimage'],
      }
      'name'                    =&gt; $product_option_value_description_query-&gt;row['name'],
      'price'                   =&gt; $product_option_value['price'],
      'prefix'                  =&gt; $product_option_value['prefix']
  );
  </code></pre>
  
  <p>can i do something like this....</p>
  
  <p>here is my error</p>
  
  <pre><code>  Parse error: syntax error, unexpected T_IF, expecting ')' in /Users/mattelhotiby/Sites/posnation/shop_pos/catalog/model/catalog/product.php on line 419 
  </code></pre>
  
  <p>Actually i did this </p>
  
  <pre><code>if (isset($product_option_value_description_query-&gt;row['smallimage'])) {
      $smallimage = $product_option_value_description_query-&gt;row['smallimage'];
  }else{
      $smallimage = '';
  }
  $product_option_value_data[] = array(
      'product_option_value_id' =&gt; $product_option_value['product_option_value_id'],
      'smallimage'                  =&gt; $smallimage,
      'name'                    =&gt; $product_option_value_description_query-&gt;row['name'],
      'price'                   =&gt; $product_option_value['price'],
      'prefix'                  =&gt; $product_option_value['prefix']
  );
  </code></pre>
  
  <p>But i still want to know f there is a way to do an if within this array declaration</p>