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
PHP5/Zend 2.0 - Resources
PHP5 Snapshots
Help on query replacing the date
Hi Pals,
some query on multilingual website
Hi all,Which is the simplest and easiest method to make a website multilingual,is it putting files in different folder for different languages? or something else ?any suggestions will be
Gaining access to Drop Down Menu Variable
code is below, I am creating a drop down menu. I want to echo the value selected in the drop down menu in the php file that is executed afterwards. when I echo frmcounty in the php file it returns
Help adding strtolower( to my in_array
strtolower i need to add it to this to work, iuno how.Code: $moderators = array('Admin', 'banana', 'orange');if (in_array("{$_SESSION['user_name']}", $moderators)) print('Found it!');i
User input in to variable
Hi all,I'm sure this is very easy but I'm having another brain freeze!At the end of the code I have echoed 3 bits of info to screen $ip, $_POST['ssid'] and $ssid_id".I would like to put
Gerenate tabel in Php
I whant to generate a tabel takeing data from database like this one so the results to be display on 2 columns<table width="50%" border="0" cellspacing="0"
Remove Rows From Database ad
Hi All,I have this:Code: [Select]<?phpsession_start();include('../common/dbconnect.php');$stock_id = $_GET['stock_id'];$query='SELECT * FROM users_stocks WHERE user_id ="' .
Help with captcha script needed
Hello, I am working on a script where reCAPTCHA or a similar form of CAPTCHA will be used, for the sake of this example I will talk about reCAPTCHA. I wanted to know how I could have the reCAPTCHA
RTF fomatting to email content
Im trying to sen an email with content is picked up from a rtf-file (file_get_contents('*.rtf'). Mail is sent correctly, but the formatting of the content includes rtf formatting like: