public function binaryToStringCallback($matches) { if ($matches[0] == '\\\'') { return "'"; } elseif ($matches[0] == '\\\\\\\\') { return '\\'; } return chr(octdec(substr($matches[0], -3))); }