Skip to main content
4 events
when toggle format what by license comment
Dec 7, 2010 at 17:15 comment added Stephen Aha! You may have hit a valid reason with Parameterized Queries.
Dec 7, 2010 at 16:26 comment added Alan Pearce I actually agree. As I was typing them up, I thought that I would think of some uses, but I didn't. For the database stuff, if the parameters are part of the query string, then you're right, casting has no purpose. However, when using parametrised queries (which is always a good idea), it is possible to specify the parameters' types.
Dec 7, 2010 at 15:30 comment added Stephen These are great examples of how type casting works. Yet, I'm not convinced that they fill a need. Yes, you can convert an object to an array, but why? I guess because you could then use the myriad PHP array functions on the new array, but I cannot fathom how that would be useful. Also, PHP usually creates string queries to send to a MySQL database, so the variable type is irrelevant (automatic string conversion from int or float will occur when building the query). (array) $item is neat, but useful?
Dec 7, 2010 at 14:45 history answered Alan Pearce CC BY-SA 2.5