title: PHP - Parse error: syntax error, unexpected T_IF
body: <p>Im getting Parse error from:</p>
  
  <pre><code>$uphalfh = if(isset($price30in)) { echo $price30in-&gt;textContent;}
  if(isset($price30out)) { echo ", " . $price30out-&gt;textContent; }
  </code></pre>
  
  <p>How can I improve this code to avoid Parse error? <strong>I understand that I can't use IF statement in $var</strong></p>
  
  <p>When I <strong>Echo Variable's</strong> its works like a charm and I get the results that I want. But how can I assign the result of <strong>Echo Variable's</strong> (on Line:10) to $uphalfh</p>
  
  <pre><code>include_once './wp-config.php';
  include_once './wp-load.php';
  include_once './wp-includes/wp-db.php';
  
  // A name attribute on a &lt;td&gt;
  $price30in = $xpath-&gt;query('//td[@class=""]')-&gt;item( 1);
  $price30out = $xpath-&gt;query('//td[@class=""]')-&gt;item( 2);
  
  // Echo Variable's
  if(isset($price30in)) { echo $price30in-&gt;textContent;} if(isset($price30out)) { echo ", " . $price30out-&gt;textContent; }
  
  // The wrong CODE i tried:
  // $uphalfh = if(isset($price30in)) { echo $price30in-&gt;textContent;}
  // if(isset($price30out)) { echo ", " . $price30out-&gt;textContent; }
  
  
  // Create post object
    $my_post = array();
    $my_post['post_title'] = 'MyTitle';
    $my_post['post_content'] = 'MyDesciprion';
    $my_post['post_status'] = 'draft';
    $my_post['post_author'] = 1;
  
  // Insert the post into the database
  $post_id =  wp_insert_post( $my_post );
  update_post_meta($post_id,'30_min',$uphalfh);
  </code></pre>