Blame view

tel.php 386 Bytes
42868d70   andryeyev   Создал GIT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  <?php
  $tel = "050-23-60-568";
  
  $arr = str_split($tel);
  $out = array();
  foreach($arr as $key=>$s){
   if(preg_match('/^[0-9]+$/',$s))array_push($out,$s);
  }
  if($out[0] == 3)array_unshift($out, '+');
  elseif($out[0] == 8)array_unshift($out, '+','3');
  elseif($out[0] == 0)array_unshift($out, '+','3','8');
  
  //if( preg_match("/^8/",$tel) )
  
  print implode('',$out);
  //print "<br>" . $arr[0];
  ?>