PHP int filter, Facebook user IDs, and 32 bit servers dont mix

Just working on a facebook app and wondering why is it always inserting the Facebook user ID as 2147483647 when the ID is something else.

I’ve been using the (int) filter as detailed in th the zend framework docs and examples, but as Facebook user IDs are larger than the largest integer a 32 bit server can handle so (int) doesn’t work.

Simple solution if your such on a 32 bit server is just to use is_numeric - refer code example below


$id = is_numeric($id) ? $id : ''; // makes Facebook IDs work on 32bit</em>


Justin Kelly

Justin Kelly

Data Engineeer, Business Analytics, Web Developer, Library Technology specialising in PHP and Tableau

Based in Melbourne, Australia

Feel free to contact me or _justin_kelly