It looks like your my_flatten will create a new array every time it's invoked - that's the first line, after all. But is that really what you want? A flattened array should have just one array, no matter how many times the method recurses, yes? In many cases you want to append new elements to an existing array, not create a new one. Can you think of a way to do that?
"I'm not back." - Bill Harding, Twister
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com