fork(1) download
  1. <?php
  2.  
  3. $str = "Ololo lalala test lorem ipsum.";
  4.  
  5. function five($n){
  6. return $n >= 5;
  7. }
  8.  
  9. function repl ( $is_enough, $str, $spaces = "", $down = FALSE) {
  10. return $down ?
  11. (strlen($spaces) > 0 ? repl ($is_enough, str_replace ( $spaces, "_", $str ), substr($spaces, 1), $down) : $str)
  12. : ($is_enough(strlen($spaces)) ? repl($is_enough, $str, $spaces, TRUE) : repl($is_enough, $str, $spaces . ' '));
  13. }
  14.  
  15. echo(repl(five, $str));
  16.  
  17. ?>
Success #stdin #stdout #stderr 0.01s 20568KB
stdin
Standard input is empty
stdout
Ololo_lalala_test_lorem_ipsum.
stderr
PHP Notice:  Use of undefined constant five - assumed 'five' in /home/KBesDC/prog.php on line 15