fork download
  1. <?php
  2.  
  3. $word = "it's not big deal";
  4. $input = strtolower($word);
  5. $split = preg_split('/\s+/', $input);
  6. $length = count($split);
  7.  
  8. $neg = "NOT_";
  9. for ($x=0; $x<$length; $x++){
  10. if (preg_match("/\bNOT\b/i",$split[$x])){
  11. $y=$x+1;
  12. $split[$x] = "{$neg}{$split[$y]}";
  13. unset($split[$y]);
  14. }
  15. }
  16. $word = implode(" ",$split);
  17. echo $word;
  18.  
  19. ?>
Success #stdin #stdout #stderr 0.03s 52480KB
stdin
Standard input is empty
stdout
it's NOT_big deal
stderr
PHP Notice:  Undefined offset: 2 in /home/7lgjsb/prog.php on line 10