Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

270
Vistas
In XAMPP numbers act different than real servers?

I noticed an error happening only with XAMPP.

I tried with 4 other live hosting accounts (including AWS, hostgator and 2 others), they all act the same upon numbers but not XAMPP. Here is what happens when running the same echo on real servers and XAMPP:

/* ALL SERVERS */
$testid = 5039307356925138;
echo (int)$testid;// 5039307356925138
echo $testid;// 5039307356925138

/* XAMPP AT WINDOWS 10 LOCALHOST*/
$testid = 5039307356925138;
echo (int)$testid;// 753691858
echo $testid;// 5.03930735692514E+15

What does this mean and why!?

After working for hours in the issue, checking every forum post,

I increased precision in php.ini and restarted apache:

precision=20 (note that all live servers are only 12!)

Now it is:

/* XAMPP */
$testid = 5039307356925138;
echo (int)$testid;// 753691858
echo $testid;// 5039307356925138

As you may already guess it is still not a solution and scripts do not run properly because XAMPP treats 5039307356925138 as 753691858 ?!?

Furthermore, increasing precision too much caused problems like 3.250000000001% or something where other numbers are used.

I tried re-installing XAMPP with new version and tried this on another computer but all are the same.

For those of you using XAMPP in windows localhost, do you see the same problem?

What might be the cause? how to fix it????

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Since you are using XAMPP, it only has 32bit for Windows. This in turn means that number may not exceed the range of [−2 147 483 648, 2 147 483 647]. On Linux and iOS I believe there's 64bit version for XAMPP.

So its very likely that your hosts use a 64 bit version, which would allow usage of much higer numbers as integers. What you're seeing is overflowing, the limit is reached and you "start again" from the bottom range.

Since PHP is loosely typed, a string and integer can be compared with the same value, eg

"10" == 10 // true
"11" == 10 // false
"10" === 10 // false because of strict comparison

So it might be a solution to work with strings instead of integers (because there's no limitation in the length of a string).


From the release announcement of PHP7, its announced that from PHP7 onwards, there will be consistent support for 64bit. So if the OS running it, and the engine is 64bit with PHP7 or higher, you will have full support for 64bit (which in turn allows you to use higher integer values).

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda