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

unescape optimized #38

Merged
merged 2 commits into from
Dec 21, 2014
Merged

unescape optimized #38

merged 2 commits into from
Dec 21, 2014

Conversation

dg
Copy link
Member

@dg dg commented Dec 21, 2014

Closes #32

@JanTvrdik
Copy link
Contributor

Nice! The following seems to have slightly better worse-case:

preg_replace_callback(
    '#(%(?:' . substr(chunk_split(bin2hex($reserved), 2, '|'), 0, -1) . '))++#i',
    function($m) {
        return rawurlencode(strtoupper($m[0]));
    },
    $s
);

On the other hand – its slower for common inputs so probably not worth it.

@dg
Copy link
Member Author

dg commented Dec 21, 2014

Reserved characters are rare, so probably not.

dg added a commit that referenced this pull request Dec 21, 2014
@dg dg merged commit cdfd0ab into nette:master Dec 21, 2014
@dg dg deleted the pull-unescape branch December 21, 2014 17:54
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.

2 participants