I have a string which is combination of letters and digits. For my application i have to separate a string with letters and digits: ex:If my string is \"12jan\" i hav to ge
Having worked more with PHPExcel, such operations are common. #Tapase,. Here is a preg_split that gets you want you want with space within the string.
<?php
$str = "12 January";
$tempContents = preg_split("/[\s]+/", $str);
foreach($tempContents as $temp){
echo '<br/>'.$temp;
}
?>
You can add a comma next to the s for comma seperated. Hope it helps someone. Anton K.
$string = "12312313sdfsdf24234";
preg_match_all('/([0-9]+|[a-zA-Z]+)/',$string,$matches);
print_r($matches);
this might work alot better