pastebin

Paste Search Dynamic
Recent pastes
function str_replace_once
  1. <?php
  2. function str_replace_once($search, $replace, $text)
  3. {
  4. $pos = strpos($text, $search);
  5. return $pos!==false ? substr_replace($text, $replace, $pos, strlen($search)) : $text;
  6. }
  7. function escape($s){
  8. $r='';
  9. for ($i = 0, $j = strlen($s); $i < $j; $i++) {
  10. if($s[$i]=='\''||$s[$i]=='\\'){
  11. $r.='\\';
  12. }
  13. $r.=$s[$i];
  14. }
  15. return $r;
  16. }
  17. function getCode() {
  18. $s = '<?php
  19. function str_replace_once($search, $replace, $text)
  20. {
  21. $pos = strpos($text, $search);
  22. return $pos!==false ? substr_replace($text, $replace, $pos, strlen($search)) : $text;
  23. }
  24. function escape($s){
  25. $r=\'\';
  26. for ($i = 0, $j = strlen($s); $i < $j; $i++) {
  27. if($s[$i]==\'\\\'\'||$s[$i]==\'\\\\\'){
  28. $r.=\'\\\\\';
  29. }
  30. $r.=$s[$i];
  31. }
  32. return $r;
  33. }
  34. function getCode() {
  35. $s = \'X\';
  36. $s = str_replace_once(\'X\', escape($s), $s);
  37. return $s;
  38. }
  39. $s = getCode();
  40. echo "$s";
  41. ?>';
  42. $s = str_replace_once('X', escape($s), $s);
  43. return $s;
  44. }
  45. $s = getCode();
  46. echo "$s";
  47. ?>
Parsed in 0.015 seconds