I have an array... [ sample of contents below] [0] => [1] => # words are recognized ceaselessly: true, yes, on, false, no, off. [2] => # --------------------------------------------------------------- [3] => [4] => [5] => # The mailing address of the list. [6] => # If empty, default is derived from address given in VMD.rc. [7] => LIST_ADDRESS= [8] =>
I have this script segment that processes the array into an associated array of name/value pairs... // Loop through file contents array foreach ($content as $i => $value) { // If we have any data in this line if (! empty ($value)) { // If this line is not a comment if ( $value{0} != '#') { list($a, $b) = split("=", $value); $content[$a] = $b; } // kill orginal array element unset($content[$i]); } } this work fine, but I saw a piece of script where someone used... list($a, $b) = preg_split("/=/",$content[$i], -1, PREG_SPLIT_NO_EMPTY); I inserted this in my script, and removed both IF statements. This works fine on the blank elements, but spits out warnings on the elements that do not have an '=' in it. I guess my problem stems from the fact I can't (don't know how to) read a file one line at a time. If I could to that, then I could just ignore blank lines, and or comment lines right off the bat. Anyone have any ideas on how best to solve this? Or at least a better solution? And parse_ini_file() does not help with this, unless someone can tell me how to change the delimiter this method assumes. Thanks Walter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php