Hallo! I have this strings: "n0027285977", "an9100601010", "in3000008908" Is it possible that it to become following: $arr = array (n => '0027285977', an => '9100601010', in => '3000008908'); PHP: Any Idia? Thanx
Use regular expressions, something like this: Note i havent tested this so may require a little tweaking preg_match("/(A-z+)(0-9+)/",$inputString,$retMatchArray); print_r($retMatchArray); Code (markup):
thank you! but if I use this preg_match("/(A-z+)(0-9+)/",n0027285977,$retMatchArray); print_r($retMatchArray); PHP: The result is Array() .....
Use quotes around the string i.e. [URL="http://www.php.net/preg_match"][COLOR=#000066]preg_match[/COLOR][/URL][COLOR=#66CC66]([/COLOR][COLOR=#FF0000]"/(A-z+)(0-9+)/"[/COLOR],"n0027285977",[COLOR=#0000FF]$retMatchArray[/COLOR][COLOR=#66CC66])[/COLOR]; [URL="http://www.php.net/print_r"][COLOR=#000066]print_r[/COLOR][/URL][COLOR=#66CC66]([/COLOR][COLOR=#0000FF]$retMatchArray[/COLOR][COLOR=#66CC66])[/COLOR]; Code (markup):
No I said im not testing this, I don't have access to a server to test at the minute. The code ive given you is 99% correct, try mucking about with it yourself