title: How to compare session value with a multpile folder name in php?
body: <p>If there is a multiple folder from which you want to retrieve a data or read a file. For example there are 10 folder named :</p>
  
  <ul>
  <li>A, B, C, D, E, F, G, H, I, J</li>
  </ul>
  
  <p>And you are sending a value in session, how to write condition to which folder to be read instead of writing a long code of <strong>if else</strong> like this</p>
  
  <pre><code>        if($_SESSION["val"]== 'A')
           {
            //code to read the folder
           } elseif ($_SESSION["val"]== 'B')
           {
            // code to read the folder
           } elseif ($_SESSION["val"]== 'c')
           {
            // code to read the folder
           } elseif ($_SESSION["val"]== 'D')
           {
           // code to read the folder
           }
  </code></pre>
  
  <p>Is there any possible way to make this code shorter? Since writing if else for each values will be tedious.</p>