diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2004-10-20 22:44:43 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2004-10-20 22:44:43 +0000 |
commit | 0818faee7f4f3501b5521e31a830e647cea2d1ec (patch) | |
tree | db1f5293d1f72428a7c88901efa8046b19e16816 | |
parent | 14fac3dd026c351fde4e3cda7e4af089b5b29b09 (diff) | |
download | php-git-0818faee7f4f3501b5521e31a830e647cea2d1ec.tar.gz |
Slight optimization in str_split() when split length is the same or greater
then the string length.
-rw-r--r-- | ext/standard/string.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c index e5b694d124..32a37b0ecc 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -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; |