Can somebody tell me what I am doing wrong really? I am going nuts, the following code works perfect on localhost/WIN and when I try it on the webhost/linux it gives warnings:
$lines = file('english.php'); foreach($lines as $line) { $matches=array(); if (preg_match('/DEFINE\(\'(.*?)\',\s*\'(.*)\'\);/i', $line, $matches)) { $keys[] = $matches[1]; $values[] = $matches[2]; } } $lang = array_combine($keys, $values);
When I test on webhost:
Warning: array_combine() expects parameter 1 to be array, null given in /home/xx/public_html/xx on line 616
But on local server (windows xp) it works perfect. I do not know what I am doing wrong, please help me resolve this nightmare 🙁
Thanks.
I don’t see anything obviously wrong with your code, but I’m curious why you’re building separate arrays and then combining them rather than just building a combined array:
(I’ve also changed your regex to handle single quotes.)