Slightly modified function.
[squirrelmail.git] / functions / strings.php
index a5c0abcc349c23d209a2bd68eef493cd7a2ff2ce..2a6a1e15b2d498069a7c81eb85246fe21064b1f1 100644 (file)
@@ -72,11 +72,17 @@ function readMailboxParent($haystack, $needle) {
  */
 function next_pos_minus_white ($haystack, $pos) {
     $len = strlen($haystack);
-    for ( ; $pos < $len; $pos++ ) {
-        $char = substr($haystack, $pos, 1);
-        if ( $char != ' ' && $char != "\t" && $char != "\n" && $char != "\r" ) {
+    while ($pos < $len) {
+        /* Get the next character. */
+        $c = substr($haystack, $pos, 1);
+        
+        /* Check the next character. */
+        if (($c != ' ') && ($c != "\t") && ($c != "\n") && ($c != "\r")) {
             return $pos;
         }
+
+        /* Increment position in string. */
+        ++$pos;
     }
     return -1;
 }