title: multiple ternary operators in wordpress/php
body: <p>I am working on a php code as shown below:</p>
  
  <pre><code>$special_reports = new \WP_Query([
      'post_type' =&gt; 'cpac-special-report',
      'orderby' =&gt; 'menu_order',
      'order' =&gt; 'ASC',
      'posts_per_page' =&gt; $data-&gt;{"toggle_status"} == 3 ? 2 : 4,
      'posts_per_page' =&gt; $data-&gt;{"toggle_multi_status"} == 1 ? 3 : 4,
      'posts_per_page' =&gt; $data-&gt;{"toggle_multi_status"} == 2 ? 1 : 4,
      'posts_per_page' =&gt; $data-&gt;{"toggle_multi_status"} == 3 ? 2 : 4,
      'posts_per_page' =&gt; $data-&gt;{"toggle_multi_status"} == 4 ? 3 : 4
  ]);
  </code></pre>
  
  <p>I want to minimize the above php code and use multiple ternary operators. This is what <strong>I have tried</strong> but I am not getting the desired o/p. </p>
  
  <pre><code>$special_reports = new \WP_Query([
      'post_type' =&gt; 'cpac-special-report',
      'orderby' =&gt; 'menu_order',
      'order' =&gt; 'ASC',
      'posts_per_page' =&gt; $data-&gt;{"toggle_multi_status"} == 1 ? 3 : $data-&gt;{"toggle_multi_status"} == 2 ? 1 : $data-&gt;{"toggle_multi_status"} == 3 ? 2 : $data-&gt;{"toggle_multi_status"} == 4 ? 1:4
  ]);
  </code></pre>
  
  <p><strong>Problem Statement:</strong> </p>
  
  <p>I am wondering what changes I should make in the php code which I have tried above so that when, </p>
  
  <pre><code>$data-&gt;{"toggle_multi_status"} == 1 then it should print 3
  $data-&gt;{"toggle_multi_status"} == 2 then it should print 1
  $data-&gt;{"toggle_multi_status"} == 3 then it should print 2
  $data-&gt;{"toggle_multi_status"} == 4 then it should print 3
  </code></pre>