LonghornPHP 2026

Voting

: min(eight, four)?
(Example: nine)

The Note You're Voting On

support at extollit dot com
6 years ago
Suppose you want to reverse the operation, here is a way to "ldap_unescape"

<?php

function ldap_unescape($string) {
    return
        preg_replace_callback(
            "/\\\\[\da-z]{2}/",
            function ($matches) {
                $match = array_shift($matches);
                return hex2bin(substr($match, 1));
            },
            $string
        );
}

$result = ldap_unescape("uid=\\61\\6c\\70\\68\\6f\\6e\\7a\\6f,ou=people,dc=foo,dc=com"); // uid=alphonzo,ou=people,dc=foo,dc=com

?>

<< Back to user notes page

To Top