title: How to read multiple values from JSON object array in php?
body: <pre><code>&lt;?php      
      $output['toggle_multi_tiles']=$_POST['toggle_multi_tiles'];  
  
      $fp = fopen('../feeds/ptp-ess_landing.json', 'w');
      fwrite($fp, json_encode($output));
      fclose($fp);
      logActivity();
  
      if(file_exists('../feeds/ptp-ess_landing.json')){
      $data = json_decode(file_get_contents('../feeds/ptp-ess_landing.json'));
      }
  ?&gt;
  </code></pre>
  
  <p>I have a <strong>JSON</strong> as shown below: </p>
  
  <pre><code>{"toggle_multi_tiles":["0","1","2","3"]}
  </code></pre>
  
  <p><br></p>
  
  <p>What I want is from the <strong>php code below</strong> I want it to print as: </p>
  
  <pre><code>&lt;p&gt;Hello World&lt;p&gt;
  &lt;p&gt;Logical World&lt;p&gt;
  &lt;p&gt;Good Morning &lt;/p&gt;
  &lt;p&gt;Good Evening&lt;/p&gt;
  </code></pre>
  
  <p>It should not print <code>&lt;p&gt;Good Day&lt;/p&gt;</code>   </p>
  
  <blockquote>
    <p>Php code:</p>
  </blockquote>
  
  <pre><code>&lt;?php if ($data-&gt;{"toggle_multi_status"} == 1) {
      if(in_array("0", $data-&gt;toggle_multi_tiles)) { ?&gt;     
          &lt;p&gt;Hello World&lt;p&gt;
      &lt;?php } else if (in_array("1", $data-&gt;toggle_multi_tiles)) { ?&gt;
          &lt;p&gt;Logical World&lt;p&gt;
      &lt;?php } else if(in_array("2", $data-&gt;toggle_multi_tiles)) { ?&gt;
          &lt;p&gt; Good Morning &lt;/p&gt;
      &lt;?php } else if(in_array("3", $data-&gt;toggle_multi_tiles)) { ?&gt;
          &lt;p&gt;Good Evening&lt;/p&gt;
      &lt;?php }
      &lt;?php } else if(in_array("4", $data-&gt;toggle_multi_tiles)) { ?&gt;
          &lt;p&gt;Good Day&lt;/p&gt;
      &lt;?php }
  }
  ?&gt;
  </code></pre>
  
  <p><code>$data-&gt;toggle_multi_tiles</code> is reading from JSON.</p>