Array parameters pass to function by reference. If the function modifies the content of its array parameter, the array of the caller changes. Therefore, you "return" via parameter.
Option 2 is to create a class that holds an array, and then return class object.