fork download
  1. <?php
  2.  
  3. $arrwords = array_flip(array(0=>'zero',1=>'one',2=>'two',3=>'three',4=>'four',5=>'five',6=>'six',7=>'seven',8=>'eight',9=>'nine'));
  4.  
  5. $s = "my long STRING with some Numbers 402three1345233 4023one345233";
  6.  
  7. $sanitised = array();
  8. foreach (explode(" ", $s) as $word) {
  9. $num = strtr(strtolower($word), $arrwords);
  10. $sanitised[] = is_numeric($num) ? str_repeat("*", strlen($word)) : $word;
  11. }
  12.  
  13. echo implode(" ", $sanitised);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
my long STRING with some Numbers *************** *************