title: php error reporting Uninitialized string offset: 0
body: <p>i am doing a stuff in php and not it is debug mode. So i am us</p>
  
  <pre><code>error_reporting(E_ALL);
  </code></pre>
  
  <p>but When i try to access any character of string it gives me error due to the error reporting.</p>
  
  <pre><code>$sentence = "Hello World"; 
  $sentence[0]   //Uninitialized string offset: 0
  </code></pre>
  
  <p>edited:</p>
  
  <pre><code>public static function prepareSentence($sentence)
  {
      $sentence = trim($sentence);
      if ($sentence[0] == '"')  //Uninitialized string offset: 0 
          $sentence = substr($sentence, 1, strlen($sentence));
  
      if ($sentence[strlen($sentence) - 1] == '"')
          $sentence = substr($sentence, 0, -1);
  
      if ($sentence[0] == '"' || $sentence[strlen($sentence) - 1] == '"')
          return self::prepareSentence($sentence);
      return $sentence;
  }
  </code></pre>
  
  <p>How should I do in order to work in dev mode. I need the  error_reporting(E_ALL);</p>
  
  <p>thanks in advance.</p>