function mysql_unescape_string($s) { $sl=strlen($s); for ($a=0;$a<$sl;$a++) { $c=substr($s,$a,1); if ($c=="\\") { switch(substr($s,$a+1,1)) { case "0": $c="\0"; break; case "n": $c="\n"; break; case "t": $c="\t"; break; case "r": $c="\r"; break; case "b": $c="\b"; break; case "'": $c="'"; break; case "\"": $c="\""; break; case "\\": $c="\\"; break; case "%": $c="%"; break; case "_": $c="_"; break; default: echo("unhandled exception!"); } // advance the counter because we are pealing off the char after the scanned \ $a++; } $s2.=$c; } return $s2; } ?>
|
|