PHP — Convert string to bigint

前端 未结 5 1512
眼角桃花
眼角桃花 2021-01-14 10:34

I have the following string which i need to convert to integer or bigint.

$test=\"99999977706\";

I tried:

echo (int)$test;
         


        
5条回答
  •  难免孤独
    2021-01-14 11:07

    MySQL isn't going to know the difference. Just feed the string into your query as though it is a number without first type casting it in PHP.

    For example:

    $SQL = "SELECT * FROM table WHERE id = $test";
    

提交回复
热议问题