Avatar of rcowen00
rcowen00
Flag for United States of America asked on

PHP Array updating 2147483647 if >9 characters entered

I have the following input and it works fine unless the user enters >9 characters.  On record 1002 the entry is 10 characters long and looks correct in the array, but updates as "2147483647".  No matter what is entered if it is >9 characters it always returns this number.  I have searched to entire project for 2147483647, but found nothing.  Any ideas?

The array returns

Array ( [421] => 5555 [422] => 0 [1001] => 0 [1002] => 5555555555 [1003] => 0 [1004] => 0 [1006] => 0 [1028] => 0 )

<input class="mainText" id="ordNumber" name="ordNumber[<?php echo $reprocessingKey;?>]" type="text" value="<?php echo $orderNumber; ?>"/

Open in new window

PHP

Avatar of undefined
Last Comment
Vampireofdarkness

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Vampireofdarkness

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dave Baldwin

2147483647 is the highest positive value for a signed 32-bit integer.  Something is casting it as an integer.
Vampireofdarkness

Just to elaborate a little more, this is (((2^32)/2) - 1) (0 counts!) and the 32-bit limit, which is where 64-bit computing comes into play. 2^64 is considerably higher.

Unsigned fields remove the need to divide by 2. Signed is essentially 2^31-1, whereas unsigned is 2^32-1
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy