title: how to get first character from array in php
body: <ul>
  <li>I need to create brand for an eCommerce site.</li>
  <li>I need a solution that gives me first character from an array.</li>
  <li>I tried some code but it was not so useful.</li>
  <li>I need brand like I mentioned bellow.</li>
  </ul>
  
  <p>like </p>
  
  <pre><code>A             
  Alpha
  Aloo
  Amakeaviral
  
  B
  Boki
  Bone
  </code></pre>
  
  <p>my data coming from database, in a array.
  I need first character from array.</p>
  
  <p><strong>I tried:</strong></p>
  
  <pre><code>$my_array = array("Alpha", "Aloo", "Amakeaviral", "Boki", "Bone");
  
  for($i = 0; $i &lt;= count($my_array); $i++){
      $first_char = $my_array[$i]{0}; 
      echo $first_char;
  }
  </code></pre>
  
  <p>but this not working well.
  How can I do this?</p>