fork download
  1. <?php
  2. $code = <<<CODE
  3. #you can use the mkdir() function to make a new dir.
  4. mkdir("love");
  5. echo "Hello world";
  6. fopen("home.php");
  7. //mkdir()
  8. /* fopen() */
  9.  
  10. # CAVEAT This have to work but it doesn't without further conditions
  11. "/*" fopen
  12. "#"
  13.  
  14. # CAVEAT 2: Doesn't handle the multiline comments when the function is not inline
  15. /* mkdir("test")
  16. fopen()
  17. */
  18. CODE;
  19. $re = "~^(?:(?!(?://|#|/\*)).)*\K((?:mkdir|fopen)\s*\()~m";
  20. echo preg_replace($re,"#$1",$code);
  21. ?>
  22.  
  23.  
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
#you can use the mkdir() function to make a new dir.
#mkdir("love");
echo "Hello world";
#fopen("home.php");
//mkdir()
/* fopen() */

# CAVEAT This have to work but it doesn't without further conditions
"/*" fopen
"#"

# CAVEAT 2: Doesn't handle the multiline comments when the function is not inline
/* mkdir("test")
#fopen()
*/