Skip to content
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

Add default value for length in mb_substr and mb_strcut #133

wants to merge 1 commit into from


4 participants
Copy link

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)

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.


This comment has been minimized.

Copy link

commented Aug 25, 2012

I think that this patch is valuable, and acceptable.


This comment has been minimized.

Copy link

commented Aug 26, 2012

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


This comment has been minimized.

Copy link

commented Sep 2, 2012

Comment on behalf of lstrojny at

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

@php-pulls php-pulls closed this Sep 2, 2012

danielbachhuber added a commit to wp-cli/php-cli-tools that referenced this pull request Aug 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.