nested php ternary trouble: ternary output != if - else
<p>I am fairly capable at using the PHP ternary operator.  However I have hit a roadblock at trying to figure out why the code below does not match the if-else equivalent structure.  The test was run three times on different numbers.  The output for each structure is below the code.</p>

<p>Ternary:</p>

<pre><code>$decimal_places = ($max &lt;= 1) ? 2 : ($max &gt; 3) ? 0 : 1;
</code></pre>

<p>Ternary Output:</p>

<blockquote>
  <p>max: -100000 decimal: 0 </p>
  
  <p>max: 0.48 decimal: 0 </p>
  
  <p>max: 0.15 decimal: 0</p>
</blockquote>

<p>If-Else</p>

<pre><code>if($max &lt;= 1)
 $decimal_places = 2;
elseif($max &gt; 3)
 $decimal_places = 0;
else
 $decimal_places = 1;
</code></pre>

<p>If-Else Output:</p>

<blockquote>
  <p>max: -100000 decimal: 2 </p>
  
  <p>max: 0.48 decimal: 2</p>
  
  <p>max: 0.15 decimal: 2</p>
</blockquote>

<p>Can anyone please tell me why the these two control stuctures do not output the same data?</p>
