Imagine three options:
a) There is an XML file. A PHP5 script loads it and puts it into a DOM
document object. Then, given an input string, a function looks via XPath
for a node with that name (or possibly value of an attribute) and returns
the node's content.
b) There is a text file containing a serialized array. PHP script opens it
and deserializes the array into a variable; then, given an input string,
looks for an array element with the same key and returns the element's
value.
c) There is a PHP file containing just a definition for an array. PHP
script includes it and, given an input string, looks for an array element
with the same key and returns the element's value.
Does anyone have any idea which option would be the fastest, and which the
slowest of the three?
Thanks,
Berislav
a) There is an XML file. A PHP5 script loads it and puts it into a DOM
document object. Then, given an input string, a function looks via XPath
for a node with that name (or possibly value of an attribute) and returns
the node's content.
b) There is a text file containing a serialized array. PHP script opens it
and deserializes the array into a variable; then, given an input string,
looks for an array element with the same key and returns the element's
value.
c) There is a PHP file containing just a definition for an array. PHP
script includes it and, given an input string, looks for an array element
with the same key and returns the element's value.
Does anyone have any idea which option would be the fastest, and which the
slowest of the three?
Thanks,
Berislav
Comment