Instead of modifying by ref, this should use `array_map`.