php - Directory list into associative array -


possible duplicate:
php split string integer element , string

i have directory these files

filea10.txt fileb20.txt filec5.txt 

i need read list array:

filea => 10 fileb => 20 filec => 5 

what fastest way or function this?

$arr = array(); foreach (glob('*.txt') $file) {    list($name,$num) = preg_split('/\.|(?<=\d)(?=\d+)/', $file);    $arr[$name] = $num; } 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -