]> granicus.if.org Git - php/commitdiff
Slight optimization in str_split() when split length is the same or greater
authorIlia Alshanetsky <iliaa@php.net>
Wed, 20 Oct 2004 22:44:43 +0000 (22:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 20 Oct 2004 22:44:43 +0000 (22:44 +0000)
then the string length.

ext/standard/string.c

index e5b694d1246bd764cb928b6cf524223b71485a64..32a37b0eccfa88a8da72e5f29bc85e49009b72a2 100644 (file)
@@ -4782,6 +4782,11 @@ PHP_FUNCTION(str_split)
 
        array_init(return_value);
 
+       if (split_length >= str_len) {
+               add_next_index_stringl(return_value, str, str_len, 1);
+               return;
+       }
+
        n_reg_segments = floor(str_len / split_length);
        p = str;