XML PHP Function
Budget: £10 – £20 GBP
We need someone to write a PHP function that will take an XML string as input and return a multi-level associative array with key => value pairs. I have attached an example XML file and another file with an example of what the final array should look like (although this is only a suggestion and only shows a very small part of the data, but it should be clear what is required). Target PHP version is 8.1 so please do not use any deprecated code and you may use anything new to 8.1
The function must return an associative array in all cases. The top level "status" key must always be present and must have a value of "ok", "warn" or ""fail".
If "status" is "ok" then the "error" value must be an empty array and the "result" array must be complete with all data expected.
If "status" is "warn" then "error" must contain an array of problems found, e.g. missing keys, "result" must contain all successfully decoded keys.
If "status" is "fail" then "error" must contain a list of all problems found and "result" must be an empty array.
The function must return an associative array in all cases. The top level "status" key must always be present and must have a value of "ok", "warn" or ""fail".
If "status" is "ok" then the "error" value must be an empty array and the "result" array must be complete with all data expected.
If "status" is "warn" then "error" must contain an array of problems found, e.g. missing keys, "result" must contain all successfully decoded keys.
If "status" is "fail" then "error" must contain a list of all problems found and "result" must be an empty array.