I’m wondering if anyone knows how to build an XML file, dynamically from a list of classes?
The classes contains public variables, and look like this.
class node {
public $elementname;
}
I do note that some of the classes are named the same as variables, and in this case, the node would be a subnode element of a node:
class data {
public $dataaset;
}
class dataset {
public $datasetint;
}
would be:
<data>
<dataset>datasetint</dataset>
</data>
Maybe something in SimpleXML or something?
The only solution i can think of linking 2 or more unrelated class is using
Annotations.Annotations is not supported by default in PHP but currently in RFC (Request for Comments: Class Metadata) but bending the time is supported or rejected you can create yours using
ReflectionClass&CommentsfunctionalityExample If you have 3 classes like this
Then you can run a code like this
Output
Function Used