- Loading all the nodes at once instead of loading them one by one.
- Move the load of multiple nodes into a single statement instead of loading one node at a time in the loop.
- Use the getValue method to retrieve all the values at once instead of calling it multiple times.
- Use the
array_mapfunction to clean the HTML content of all the fields in one go instead of using a loop. - Use the
json_decodemethod's second argument to parse the data directly into an associative array, instead of converting it to an object and then back to an array. - Consider using the
array_reducefunction instead of iterating over the data and pushing items into separate arrays, to reduce the number of array operations.