title: How to insert a character inside a string at a fixed position from the end?
body: <p>Example: <code>845</code>, <code>945</code>, <code>1045</code>, <code>1145</code>.</p>
  
  <p>If the length of the string is 3 then I am trying to add a <code>:</code> after the first character, e.g. <code>8:45</code>. If the length of the string is 4 then I am trying to add <code>:</code> after the second character, e.g. <code>10:45</code>. Not sure which method would help me do that. Any suggestions?</p>
  
  <pre><code>while($row = mysqli_fetch_array($result))
      {
  
      $message = $row['Timings'];
  
      if(strlen($message) = 3)
          {
  
          } 
      else if(strlen($message) = 4)
          {
  
          }
  </code></pre>