Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8417033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:55:55+00:00 2026-06-10T01:55:55+00:00

How to user Int64 in php like dotnet、java、c++? For example: The datatype is bigint(20)

  • 0

How to user Int64 in php like dotnet、java、c++?

For example:

The datatype is bigint(20) in mysql,I want to save value from php.I know one solution is using string in mysql procedures.

table case:

CREATE TABLE `test_int64` (
  `id` bigint(20) unsigned NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

mysql procedures case:

CREATE PROCEDURE `sp_test_int64`(IN p_id VARCHAR(20))
    NOT DETERMINISTIC
    SQL SECURITY DEFINER
    COMMENT ''
BEGIN
     INSERT INTO test_int64(id) VALUES(p_id+0);
END;

php code case:

$id = '1660820628901389';  Then execute sql 'call sp_test_int64(\''.$id.'\')'

The above method is OK, but I don’t want to do it. Are there any other solutions?

example 2:

I want to use PHP read MYSQL data output JSON code like this:

{
    "id":1660820628901389
}

but not :

{
    "id":"1660820628901389"
}

I don’t know how to do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:55:56+00:00Added an answer on June 10, 2026 at 1:55 am

    The INT type in PHP is linked to the CPU and the version of PHP installed (you can have 32bit PHP installed on 64bit CPU).

    To find out what the maximum integer PHP can support, simply

    echo PHP_INT_MAX;
    

    And this will give you the maximum. It will give you either 2 billion, or a huge number too large to read (9.2 gazillion or so).

    Note that it’s signed (-2 billion -> +2 billion, or -9 gazillion -> +9 gazilion). Where as you can specify unsigned in mySQL, you don’t have this option in PHP.

    If you only have the 2 billion limit, then you have the 32 bit version of PHP installed. You can install PHP 64 bit on a 64 bit CPU, or you’ll need to handle as a string or you could use the BC Math functions to convert the string you get back from mySQL into a numeric – but I’m not sure JSON_encode will handle it*. If you have the large number, you should be just fine and can process as an integer.

    • JSON_encode note: in the past I’ve noticed the JSON_encode and serialize convert large numbers to floating points, and then lose precision internally, even through they have been whole number ints. I’ve not tested recently or on 64bit, but is another gotcha to watch out for.

    Edit: Here’s the relevant page in the manual: http://php.net/manual/en/language.types.integer.php It also adds GMP as an alternative to BC Math

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the error: Failed to convert parameter value from a Int64 to
User first_name: Johnny age: 15 Car name: Mazda Car name: BMW I would like
User Region Points Last_Updated 1 5 0 1-Nov-09 I want this row 2 1
User scenario is like follows. My application has list of companies. Each company has
User may input character like Ā Ē ú, how to remove that mark and
User model looks sth like this: before_save :ensure_authentication_token devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable,
I am trying to save cascading in EF 4.1 code first. [Table(User)] public class
public Int64 ReturnDifferenceA() { User[] arrayList; Int64 firstTicks; IList<User> userList; Int64 secondTicks; System.Diagnostics.Stopwatch watch;
I have a database schema like follows: User 1 ---- * UserRole *----1 Role
@user = User.new @user.id returns nil but i need to know it before i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.