title: Assign if variable is set
body: <p>In PHP I find myself writing code like this frequently:</p>
  
  <pre><code>$a = isset($the-&gt;very-&gt;long-&gt;variable[$index])
              ? $the-&gt;very-&gt;long-&gt;variable[$index]
              : null;
  </code></pre>
  
  <p>Is there a simpler way to do this? Preferably one that doesn't require me to write <code>$the-&gt;very-&gt;long-&gt;variable[$index]</code> twice.</p>