title: Notice: Uninitialized string offset: 1
body: <p>i have problem in this code on line 66
  Notice: Uninitialized string offset: 1 on line 66</p>
  
  <pre><code>&lt;?php
  echo cologne_phon("d");
  echo "&lt;br /&gt;";
  echo cologne_phon("ch dc");
  echo "&lt;br /&gt;";
  echo cologne_phon("dc"); 
  
  function cologne_phon($word){
  
      /**
       * @param  string  $word string to be analyzed
       * @return string  $value represents the K?lner Phonetik value
       * @access public
       */
  
      //prepare for processing
      $word=strtolower($word);
      $substitution=array(
                          "?"=&gt;"a",
                          "?"=&gt;"o",
                          "ü"=&gt;"u",
                          "?"=&gt;"ss",
                          "ph"=&gt;"f"
                          );
  
      foreach ($substitution as $letter=&gt;$substitution) {
          $word=str_replace($letter,$substitution,$word);
      }
  
      $len=strlen($word);
  
      //Rule for exeptions
      $exceptionsLeading=array(
                               4=&gt;array("ca","ch","ck","cl","co","cq","cu","cx"),
                               8=&gt;array("dc","ds","dz","tc","ts","tz")
                               );
  
      $exceptionsFollowing=array("sc","zc","cx","kx","qx");
  
      //Table for coding
      $codingTable=array(
                         0=&gt;array("a","e","i","j","o","u","y"),
                         1=&gt;array("b","p"),
                         2=&gt;array("d","t"),
                         3=&gt;array("f","v","w"),
                         4=&gt;array("c","g","k","q"),
                         48=&gt;array("x"),
                         5=&gt;array("l"),
                         6=&gt;array("m","n"),
                         7=&gt;array("r"),
                         8=&gt;array("c","s","z"),
                         );
  
      for ($i=0;$i&lt;$len;$i++){
          $value[$i]='';
  
          //Exceptions
          if ($i==0 &amp;&amp; $word[$i]=='cr') 
              $value[$i]=4;
  
          foreach ($exceptionsLeading as $code =&gt;$letters) {
              if (in_array($word[$i].$word[$i+1],$letters)){
                  $value[$i]=$code;
              }
          }
  
          if ($i!=0 &amp;&amp; (in_array($word[$i-1].$word[$i], 
                                 $exceptionsFollowing))) {
              $value[$i]=8;        
          }                
  
          //Normal encoding
          if ($value[$i]==""){
              foreach ($codingTable as $code=&gt;$letters) {
                  if (in_array($word[$i],$letters))$value[$i]=$code;
              }
          }
      }
  
      //delete double values
      $len=count($value);
  
      for ($i=1;$i&lt;$len;$i++){
          if ($value[$i]==$value[$i-1]) $value[$i]="";
      }
  
      //delete vocals 
      for ($i=1;$i&gt;$len;$i++){//omitting first characer code and h
          if ($value[$i]==0) $value[$i]="";
      }
  
      var_dump($value);
      $value=array_filter($value);
      $value=implode('',$value);
  
      return $value;
  }  
  </code></pre>
  
  <p>i try a lot of way for fix but nothing work with me so need help please
  original code here in php site
  <a href="http://php.net/manual/en/function.soundex.php#84881" rel="nofollow noreferrer">http://php.net/manual/en/function.soundex.php#84881</a></p>