fork(3) download
  1. <?php
  2.  
  3.  
  4. $inputData ='+7-911-404-44-11';
  5. $regexp ='!^(\\+7|8)\\(?-?[0-9]{3}\\)?-?[0-9]{3}-?[0-9]{2}-?[0-9]{2}$!';
  6. $regexp1 ='![^0-9]!';
  7. $regexp2='!^7!';
  8.  
  9. if (preg_match($regexp, $inputData)) {
  10. $result =preg_replace($regexp1, '', $inputData);
  11. $result=preg_replace($regexp2, '8', $result);
  12. echo $result;
  13.  
  14. } else {
  15. echo "Пожалуйста введите номер в верном формате.\n";
  16. }
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
89114044411