How to save long int during PHP string conversion?

The following PHP code:

$someID = 124234454288758;
$queryStr => "SELECT a FROM b WHERE some_id = {$someID}";

converted to:

"SELECT a FROM b WHERE some_id = 1.2423445428876E+14"

How to get the result string as:

"SELECT a FROM b WHERE some_id = 124234454288758"

Thank!

+3
source share
3 answers

Use GMP ( http://www.php.net/manual/en/book.gmp.php ) or BCMath ( http://www.php.net/manual/en/book.bc.php ) when working with very big numbers.

+1
source

Try the following:

number_format($someID, 0, '.', '');

Help: problems with large integers

+2
source

( ), .

$someID = "124234454288758";

, , SQL-, , SQL-. , PDO prepare.

+1

Source: https://habr.com/ru/post/1776391/


All Articles