[FX.php List] Referencing output from fmresultset when element
names contain hyphens
Malcolm Fitzgerald
malcolm at notyourhomework.net
Mon May 11 16:21:43 MDT 2015
On 12/05/2015 8:19 am, Malcolm Fitzgerald wrote:
> [ not strictly an FX question ]
>
> I've just fired a query at FMS requesting a reply in the fmresultset
> grammar and I'm using SimpleXML to handle the result. I dump
> everything into a variable called $fmresultset.
>
> This is fine and works well, until I want to look at the metadata,
> which looks like this.
>
> <metadata>
> <field-definition ...
> <field-definition ...
> <field-definition ...
> <field-definition ...
>
> I'd like to use a foreach loop to build a table from the field
> definitions and it should be as simple as this:
>
> foreach ( $fmresultset->metadata->field-definition as $fld )
> foreach ( $fmresultset->field-definition as $fld )
>
> Neither works. How do I handle the hyphen?
$fmresultset->{'field-definition'}
$fmresultset->{'field-definition'}['name']
malcolm
More information about the FX.php_List
mailing list