Forráskód Böngészése

Slightly modified function.

thomppj 23 éve
szülő
commit
ec5cb39b4d
1 módosított fájl, 9 hozzáadás és 3 törlés
  1. 9 3
      functions/strings.php

+ 9 - 3
functions/strings.php

@@ -72,11 +72,17 @@ function readMailboxParent($haystack, $needle) {
  */
  */
 function next_pos_minus_white ($haystack, $pos) {
 function next_pos_minus_white ($haystack, $pos) {
     $len = strlen($haystack);
     $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;
             return $pos;
         }
         }
+
+        /* Increment position in string. */
+        ++$pos;
     }
     }
     return -1;
     return -1;
 }
 }