Jump to content

Recommended Posts

Get out of the habit of quoting everything.

 

If you want to add two numbers together use:

$new = $time + $timeout;

not

$new = "$time + $timeout";

 

Also ensure that you are actually setting $_SESSION['time']

 

Damn my bad lol, sorry i was trying every way possible last night to get it working and must not of removed the quotes lol, and the $_SESSION['time']; var is set with the login time. 100#% working

Link to comment
https://forums.phpfreaks.com/topic/153458-php-maths-help/#findComment-806245
Share on other sites

if ($time = $new) {

will set the value of $time to the value of $new, and then execute the if logic

 

if ($time == $new) {

will compare the value of $time with the value of $new and only execute the if logic if the two values are equal

 

correct, iv changed it and all i get now is

 

1239358810

1239358810 + 2

Link to comment
https://forums.phpfreaks.com/topic/153458-php-maths-help/#findComment-806252
Share on other sites

this is the code, but i cant get no results here  :(

You won't see any results because you're only printing results if $time and $new are the same... but they're not going to be the same because $new is 2 more than $time

 

if ($time == $new) {
   print $time.' and '.$new.' are the same';
} else {
   print $time.' and '.$new.' are not the same';
}

Link to comment
https://forums.phpfreaks.com/topic/153458-php-maths-help/#findComment-806583
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.