Skip to content

Commit d80ba77

Browse files
committed
split() and replace() MUST raise an error if $count is not an integer.
1 parent 2b2eeb9 commit d80ba77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

jep-014-string-functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ string replace(string $subject, string $old, string $new[, number $count])
128128
```
129129
Given the `$subject` string, `replace()` replaces occurrences of the `$old` substring with the `$new` substring.
130130

131-
The `$count` optional parameter specifies how many occurrences of the `$old` substring in `$subject` are replaced. If this parameter is omitted, all occurrences are replaced. If `$count` is negative, an error MUST be raised.
131+
The `$count` optional integer specifies how many occurrences of the `$old` substring in `$subject` are replaced. If this parameter is omitted, all occurrences are replaced. If `$count` is not an integer or is negative, an error MUST be raised.
132132

133133
The `replace()` function has no effect if `$count` is `0`.
134134

@@ -152,8 +152,8 @@ Given the `$subject` string, `split()` breaks on ocurrences of the string `$sear
152152

153153
The `split()` function returns an array containing each partial string between occurrences of `$search`. If `$subject` contains no occurrences of the `$search` string, an array containing just the original `$subject` string will be returned.
154154

155-
The `$count` optional parameter specifies the maximum number of split points within the `$search` string.
156-
If this parameter is omitted, all occurrences are split. If `$count` is negative, an error MUST be raised.
155+
The `$count` optional integer specifies the maximum number of split points within the `$search` string.
156+
If this parameter is omitted, all occurrences are split. If `$count` is not an integer or is negative, an error MUST be raised.
157157

158158
If `$count` is equal to `0`, `split()` returns an array containing a single element, the `$subject` string.
159159

0 commit comments

Comments
 (0)