Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why 1024 * 1024 * 1024 * 1024 * 1024 returns float?

<?php
$i = 1024 * 1024 * 1024 * 1024 * 1024;
var_dump($i);

output => float(1125899906842600)

why output is a float type ?

like image 674
Anri Avatar asked Mar 27 '26 05:03

Anri


1 Answers

If PHP encounter an overflow, it will cast to float.

See http://php.net/manual/en/language.types.integer.php

like image 90
Antzi Avatar answered Mar 29 '26 20:03

Antzi