Skip to content

Instantly share code, notes, and snippets.

@glagola
Created May 11, 2012 07:32
Show Gist options
  • Save glagola/2658152 to your computer and use it in GitHub Desktop.
Save glagola/2658152 to your computer and use it in GitHub Desktop.
<?php
function mysql_escape_mimic($inp)
{
if(!empty($inp) && is_string($inp)) {
return str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $inp);
}
return $inp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment