|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-12-18 21:24 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 12:00:01 2025 UTC |
Description: ------------ Integers or floats bigger than 2 to the power 32 result in an overflow and dont work as expected. See the code below. Reproduce code: --------------- not working: echo json_encode ( array ( 'number' => pow ( 2, 32 ) ) ); echo json_encode ( array ( 'number' => (int) pow ( 2, 32 ) ) ); echo json_encode ( array ( 'number' => (float) pow ( 2, 32 ) ) ); working: echo json_encode ( array ( 'number' => (string) pow ( 2, 32 ) ) ); Expected result: ---------------- not working: {"number":0} working: {"number":"4294967296"}