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
Online Event Ticket Sales
Has anyone wrote a script for online tickets sales?I have been googling and found lots of third party solutions. I was hoping to adapt a digital goods sale script. Is it possible to have a ticket sent
Greek characters in php
Hi,I'm making a script and I m using for first time greek characters.I started to write a simple drop down menu that loads some city names from the database. The names are in Greek in the database and
Change Web page language
i doing this thing first time but i dont find any suitable solution for it. On the demand of user. I want to change my web site pages in user's language without without google translater. Can
calendar dates and hours compare problem
i have a calendar in wordpress, everything works great except that i can make 2 meetings at the same date, time and room without receiving any error i don't know where to start to compare the days
distinct rows
Hi
Count number of records in all the tables with a querry URGENT PLEASE...
I downloaded ORACLE 9I DATA DUMP into my comp. There are number of tables. I need to find out the tables with records more than say 100 or so at on go. Can it be possible... If so kindly let me
Adding to an Int row in db
Hi, i have a database which houses all of the users of my site. One of the columns is for points which is default 0.What I would like to do is add 1 to this number each time they upload an image. What
On page view, minus credit
Hello all, please, I need a little help with this script. I am charging one credit (credits can be purchased, but that is unrelated) for view of a certain page. I need help in figuring out what php I
PHP - HTTP Digest Authentication - Understanding Code Help
Hi Everyone,This is my first time on your website and please excuse if I am asking silly question.I have a question about PHP HTTP DIGEST AUTHENTICATION - published in PHP Manual - php.netTheir
order by date not ID number help php
I am trying to orginize the following code to order by date not id number.any help would be greatCode: [Select]<?php // Status // 1. inshop // 2 in progress // 3 pending // 4 to be