How to return TRUE when an account was created more than 30 days ago?
I have the following date:
$udata['joined'];
– record date in time():
I tried like this
If($udata['joined'] = strtotime ("+30 days", time())){
return true;
}
Any idea why it’s not working correctly?
Return empty.
2
Answers
You are assigning a value instead of using an operator, i.e. you are using
=
instead of==
. Try this:Edit
As others pointed out, checking for equality will most likely always return false anyway, because you’d be very luck to hit the exact same timestamp!
What you are looking for is the
<=
(less than or equal) operator to check if$udata['joined']
is a timestamp before30 days ago
. In other words :I guess you want
If timestamp is smaller than (or exactly) 30 days ago
(you need to substract 30 days from now and remove all syntax errors)