title: How to use ternary operators if-elseif-else in php?
body: <p>I want to use ternary operator for if-elseif-else. But it is not working for me.</p>
  
  <p>Kindly check the code below:</p>
  
  <pre><code>$openMon = "00:01";  // The below Line Returns Time
  $openMon = "00:00";  // The below Line Returns Close
  
  &lt;td&gt;&lt;?=(($openMon == '00:00')?'Close':date("g:i a", strtotime($openMon)));?&gt;&lt;/td&gt;
  </code></pre>
  
  <p>The above line working perfectly because it returns True or false. </p>
  
  <p><strong>But when $openMon blank it returns 1am. I want when $openMon blank it returns "-"</strong> </p>
  
  <p>I want Three Things in one line like:</p>
  
  <pre><code>$openMon = "";        // This is I want in ternary operator with above two conditions
  
  if($openMon == "" ){
      $openMon ="-";
  }
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>&lt;td&gt;&lt;?=isset((openMon == "")?'-':(($openMon == '00:00')?'Close':date("g:i a", strtotime($openMon)));?&gt;&lt;/td&gt;
  </code></pre>
  
  <p>This is not working for me.</p>
  
  <p>Basically I want in ternary operator:</p>
  
  <pre><code>if($openMon == ''){
      $openMon = "-";
  }else{
      if($openMon == '00:00'){
          $openMon = "Close";
      }else{
          $openMon = date("g:i a", strtotime($openMon)));
      }
  }
  </code></pre>
  
  <p>Any Idea or suggestions would be helpful.</p>