{"id":805,"date":"2011-11-29T18:20:40","date_gmt":"2011-11-30T01:20:40","guid":{"rendered":"http:\/\/chriscarey.com\/wordpress\/?p=805"},"modified":"2011-11-29T18:31:23","modified_gmt":"2011-11-30T01:31:23","slug":"twitter-api-and-php-default-precision-of-14","status":"publish","type":"post","link":"https:\/\/chriscarey.com\/blog\/2011\/11\/29\/twitter-api-and-php-default-precision-of-14\/","title":{"rendered":"Twitter API, PHP precision and scientific notation"},"content":{"rendered":"<p>If you use PHP and the Twitter API, be on the lookout for this issue.<\/p>\n<p>Twitter IDs are up to 141 quadrillion (141 million billion). These Twitter IDs exceed PHP&#8217;s default precision of 14. So your Twitter IDs could be converted to scientific notation by PHP. <\/p>\n<p>A Twitter ID of 141675395434037249 will be stored as 1.41675395434037249E+17 once PHP gets it&#8217;s hands on it.<\/p>\n<p>This could cause code that has been working great for a while to stop working.<\/p>\n<p>Edit your php.ini and set precision to 20, or use<br \/>\nini_set(&#8216;precision&#8217;, 20);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you use PHP and the Twitter API, be on the lookout for this issue. Twitter IDs are up to 141 quadrillion (141 million billion). These Twitter IDs exceed PHP&#8217;s default precision of 14. So your Twitter IDs could be converted to scientific notation by PHP. A Twitter ID of 141675395434037249 will be stored as [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-805","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/prpYG-cZ","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/posts\/805","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/comments?post=805"}],"version-history":[{"count":7,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/posts\/805\/revisions"}],"predecessor-version":[{"id":816,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/posts\/805\/revisions\/816"}],"wp:attachment":[{"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/media?parent=805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/categories?post=805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/tags?post=805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}