So I'm wondering if anyone has a method or stumbled across something that will read a variable and recast it on the fly? I'm starting to get into more and more data thats being spooled from a text file and the type is always cast as a string coming from there. Most of these operations are being pointed to MongoDB, and as some of you may know, the type that is cast in PHP is the type that is created in Mongo.
So essentially I want to do a foreach() on an array and dynamically recast to integers / nulls when possible. Ideas?