fork download
  1. <?php
  2. /***
  3. Author: Alexis López (@AlexisThrasher)
  4. */
  5.  
  6. $string = "<script>alert('Hello World!')</script>";
  7. echo "Bad string: " . $string . "\n";
  8. echo "Sanitized with strip_tags(): " . strip_tags($string) . "\n";
  9. echo "Sanitized with RegEx: " . preg_replace('/<(.*)?>(.*)?(<(.*)?>)?/s', '', $string);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Bad string: <script>alert('Hello World!')</script>
Sanitized with strip_tags(): alert('Hello World!')
Sanitized with RegEx: