title: How to set multiple start and end time in single string
body: <p>I want to save multiple start and end time with comma separated in database.</p>
  
  <p>For example following is my array of start time and end time.</p>
  
  <pre><code>Array
  (
      [0] =&gt; 1:00
      [1] =&gt; 2:00
      [2] =&gt; 3:00
      [3] =&gt; 4:00
  )
  </code></pre>
  
  <p>I want to store it into database like <code>1:00-2:00, 3:00-4:00</code> .</p>
  
  <p>How can i do this ?</p>
  
  <p>I used following code for it.</p>
  
  <pre><code>$array = array('1:00','2:00','3:00','4:00');
  $i=0;
  foreach ($array as $key =&gt; $value) {
      if($i%2 !=0){
          echo $value.'-'.',';
      }
      echo $value.'-';
  
  $i++;
  }
  </code></pre>