note 124752 added to function.ldap-escape

From: Date: Mon, 24 Feb 2020 18:44:11 +0000
Subject: note 124752 added to function.ldap-escape
Groups: php.notes 
Request: Send a blank email to php-notes+get-214215@lists.php.net to get a copy of this message
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 ?> ---- Server IP: 45.112.84.4 Probable Submitter: 38.142.137.34 (proxied: 50.92.50.215) ---- Manual Page -- http://php.net/manual/en/function.ldap-escape.php Edit -- https://master.php.net/note/edit/124752 Del: integrated -- https://master.php.net/note/delete/124752/integrated Del: useless -- https://master.php.net/note/delete/124752/useless Del: bad code -- https://master.php.net/note/delete/124752/bad+code Del: spam -- https://master.php.net/note/delete/124752/spam Del: non-english -- https://master.php.net/note/delete/124752/non-english Del: in docs -- https://master.php.net/note/delete/124752/in+docs Del: other reasons-- https://master.php.net/note/delete/124752 Reject -- https://master.php.net/note/reject/124752 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214215) next »