Setting a variable's value according to the existence of two or more variables
<p>How can we set a variable's value according to the existence of one or more variables?
This works but I want to know if PHP has a "shorthand" version for this:</p>

<pre><code>if (isset($a)) { $x=$a; } elseif (isset($b)) { $x=$b; } 
</code></pre>

<p>In case you want the bigger picture, I need to give $x the value of $_REQUEST['a'] or $_GET['a'], whichever one exists each time.</p>

<p><strong>EDIT</strong>: ternary operators will do the trick for 2 variables. Could the functionality expand for more than 2? Example</p>

<pre><code>if (isset($a)) { $x=$a; } elseif (isset($b)) { $x=$b; } else { $x=$c; }
</code></pre>
