title: php condition inside array
body: <p>In the code below, I need to be able to set a different where condition when {VarName} is empty (blank or null).</p>
  <p>Is it possible to have an if condition inside the array definition? Alternatively, can I have the validation inside of the sql query?</p>
  <pre><code>$col[&quot;editoptions&quot;] = array(
               &quot;value&quot;=&gt;$str, 
               &quot;onchange&quot; =&gt; array(
                array(
                &quot;sql&quot;=&gt; &quot;select distinct place as k, place as v from mytable                                       
                        WHERE Name = '{VarName}' 
                        AND Area = '{VarArea}'
                        ORDER BY place&quot;,
                &quot;update_field&quot; =&gt; &quot;Localidade&quot; )));
  </code></pre>