fork download
  1. <?php
  2.  
  3. function own_strlen($str) {
  4. $count = 0;
  5. while(@$str[$count] != "")
  6. $count++;
  7. return $count;
  8. }
  9.  
  10. function removeNonNumericalCharacters($str) {
  11. $result = "";
  12.  
  13. for($count = 0; $count < own_strlen($str); $count++) {
  14. $character = $str[$count];
  15. if((string)(int)$str[$count] === $character)
  16. $result .= $str[$count];
  17. }
  18.  
  19. return $result;
  20.  
  21. }
  22.  
  23. $string = "(123) 011 - 34343678";
  24. echo removeNonNumericalCharacters($string);
  25.  
Success #stdin #stdout 0.01s 24448KB
stdin
Standard input is empty
stdout
12301134343678