Skip to content

February 6, 2009

PHP – print statement works differently on 32 bits and 64 bits platforms

by Joe Kuan

phpJust notices a strange behaviour in PHP (4.3.4) print statement that acts differently on 32 bits and 64 bits platforms, both have the same OS.

The task was to report the time from the webserver side to the javascript on the client side.

So here is the pseudo-code

<?php 
$curTime = time() * 1000;
?>
var Digital = new Date(parseInt(<?php print $curTime; ?>));
 

The code worked fine on 64 bits platform but not 32 bits. The reason is that the print statement on 32 bits returned as

1.233891534E+12

whereas on 64 bits machine

1233913289000

Well, I guess I have to do this instead

print time() . “000”;

I work for iTrinegy and here are my other technical blogs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

%d bloggers like this: