PHP problem, I'm sure this has an easy solution, just can't see it

brisholx

New Member
I am new to php and this little bugger has been eating up my day, perhaps it's due to some property of php I am unaware of?As part of some code for getting some data out of an xml file (using the event based Expat parser), I have the following code\[code\]$xmlFields;$fieldName = "";\[/code\]............... some other code ............\[code\]function char($parser,$data){ global $xmlFields, $fieldName; if($fieldName) { if($fieldName == "brandName" || "oeNumber" || "articleId" || "quantityPerPackingUnit" || "attrName") { $xmlFields[$fieldName] = $data; echo $data; } }}\[/code\]I try to echo \[code\]$xmlFields["brandName"]\[/code\] for example, and nothing is printed.1) I know that \[code\]$xmlFields["brandName"]\[/code\] is non-empty because echo $data actually returns something.2) If I change to \[code\]$xmlFields[$fieldName] = 'some string';\[/code\]then \[code\]echo $xmlFields["brandName"]\[/code\] will print 'some string'so why won't it print \[code\]$xmlFields["brandName"]\[/code\]?Thanks in advance,Yazan
 
Back
Top