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

Closed
wants to merge 1 commit into from

Conversation

4 participants
@Irker
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2012

I think that this patch is valuable, and acceptable.

@lstrojny

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2012

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

@php-pulls

This comment has been minimized.

Copy link

commented Sep 2, 2012

Comment on behalf of lstrojny at php.net:

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.