'210010106140040100' == '210010106140040101'
Posted on
16th Feb 2014 07:03 pm by
admin
Debugging this simple line of a PHP script
Code: if($a == $b){ }
I've found that with value of
$a = '210010106140040100' (type = string)
$b = '210010106140040101' (type = string)
the result of the comparison is TRUE
the same if i compare 2 integer
$a = 210010106140040100 (type = int)
$b = 210010106140040101 (type = int)
$a == $b ( true )
If I use the === operator
'210010106140040100' === '210010106140040101' (comparison of strings: result is FALSE)
210010106140040100 === 210010106140040101 (comparison of numbers: result is TRUE)
I think it could be caused by the fact that the string is 'like' integer, but exceed the standard size of integer number.
But the final result remain a mistery for me: I've tested some others 'big' numbers and I've found for example:
18014398509481980==18014398509481981 (true) !!!!
18014398509481982==18014398509481981 (false) !!!!
In my specific script i can handle this specific comparison using the === operator, because i can assume that the variable are string.
But i'd like to know why this happen, and i'd appreciate suggestions about how to efficiently compare 'big' integers.
Thanks!
I use PHP 5.2 with IIS
No comments posted yet
Your Answer:
Login to answer
199
53
Other forums
simple ping code
been searchin the site/web and found code thats simple but doesnt work.
I have a personal we
phpMailer will not connect using SMTP
I am trying to use phpMailer with smtp:
Code: [Select]$mailer = new PHPMailer();
$mailer-&
rdns with php
I am trying to build a script that will show all of the different domains that are hosted on the sam
EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules t
Display search result
Hi!
I have a SQL database with information about albums and track (music).
This is wh
Can php detect connection speed and thereafter swap out elements?
No code to post, lads, yet. Just looking for a yay or nay at this stage:
Can a php script be
IDOC error
Hi,
When i send IDOC from ECC system to MII there is no problem ECC side, i says message sent succe
MySQL query problem
When I try to run the following piece of code, I get this error:
QuoteWarning: mysql_query(): sup
InternetOpenUrl() Invalid cert
Hi all,
Does anyone know how to prevent calls to InternetOpenUrl() from failing with erro
i have no idea why this isn't working
Code: <?php
session_start();
include("connect.php");
error_reporting(E