Skip to content

Add default value for length in mb_substr and mb_strcut #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Add default value for length in mb_substr and mb_strcut #133

wants to merge 1 commit into from

Conversation

Irker
Copy link
Contributor

@Irker Irker commented Jul 17, 2012

In this commit(s) I added "null" default values for length in mb_strcut and mb_substr.
So now we can write:
$result = mb_substr("12345", 2, null, "UTF-8");
And get expected result : "345"

I added this similar to function array_slice (length parametr) php.net/manual/en/function.array-slice.php

I think no great BC there. All exist tests passed.

If you like this idea, I can add tests for my patch.

Yes, I know about mb_internal_encoding.
Yes, I know about discussion about "default" keyword.

@hirokawa
Copy link
Contributor

I think that this patch is valuable, and acceptable.

@lstrojny
Copy link
Contributor

@Irker this fixes a long standing inconvenience, thanks. Could you add a test case?

@php-pulls
Copy link

Comment on behalf of lstrojny at php.net:

Merged to PHP-5.4 and master. Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants