Le mai poti sparge dupa spatiu si lungime minima:
Dupa executie:Cod:<?php $str="0755 065716 0744 678 069 0766 497 532 076 071 9733 0740 219 163 +40720 55 22"; $c=0; for ($x=0; $x < strlen($str)-1; $x++){ if($str[$x] == ' ' && ($str[$x+1] == '0' || $str[$x+1] == '+') && $c >= 10){ $str[$x] = '$'; $c = 0; } else { $c++; } } $str = preg_replace('/\s+/', '', $str); var_dump(explode('$',$str));
Cod:array(6) { [0]=> string(10) "0755065716" [1]=> string(10) "0744678069" [2]=> string(10) "0766497532" [3]=> string(10) "0760719733" [4]=> string(10) "0740219163" [5]=> string(10) "+407205522" }



Răspunde cu citat