Forum Moderators: coopster
$text = file_get_contents('textfile.txt');
$check = preg_match_all('/$([\w])+[\s]*=[\s]*#([^#]+)#/', $text, $matches);
foreach($matches[1] as $k => $v){
/* if you want to get rid of line endings as in example */
$matches[2][$k] = str_replace('\n', '', $matches[2][$k]);
$$v = $matches[2][$k];
}
If you're on windows or mac, you might also str_replace for \r\n or \r\n\r or whatever the line endings are for those platforms. Test before you deploy (you're smart enough to do that - more here as a 'general disclaimer') - I haven't tested it.