fork download
  1. <?
  2. $_SERVER['REDIRECT_SSL_CLIENT_S_DN'] = '../CN=\x00M\x00\xC4\x00,\x00I\x00S\x00,\x004\x000\x003\x001\x002\x000\x000\x002/SN=..';
  3. $pattern = '/CN=(.*)\\/SN=/';
  4. preg_match($pattern, $_SERVER['REDIRECT_SSL_CLIENT_S_DN'], $server_matches);
  5.  
  6. $string = $server_matches[1];
  7. $string = str_replace('\x00', NULL, $string);
  8.  
  9. preg_match('/\\\x[A-F0-9]{2}/', $string, $matches);
  10. foreach ($matches as $key => $value) {
  11. $string = str_replace($value, utf8_encode(chr(hexdec($value))), $string);
  12. }
  13.  
  14. echo($string);
  15. echo "\n";
  16. //$splitted = str_split($string);
  17. $splitted = preg_split('//u', $string);
  18. print_r($splitted);
  19.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
MÄ,IS,40312002
Array
(
    [0] => 
    [1] => M
    [2] => Ä
    [3] => ,
    [4] => I
    [5] => S
    [6] => ,
    [7] => 4
    [8] => 0
    [9] => 3
    [10] => 1
    [11] => 2
    [12] => 0
    [13] => 0
    [14] => 2
    [15] => 
)