1 Replies - 157 Views - Last Post: 01 February 2012 - 11:00 AM Rate Topic: -----

Topic Sponsor:

#1 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 36
  • View blog
  • Posts: 599
  • Joined: 15-December 09

strtotime not allowed in lambdas?

Posted 01 February 2012 - 10:51 AM

I just tried to use strtotime in an anonymous function and it didn't work. :(


$the_date = function($to_timestamp){
    return strtotime($to_timestamp);
};

echo $the_date('2 Jan 2012'); // This returns nothing.




Unless I'm using it wrong. I'm not sure.

This post has been edited by hiddenghost: 01 February 2012 - 10:53 AM


Is This A Good Question/Topic? 0
  • +

Replies To: strtotime not allowed in lambdas?

#2 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 36
  • View blog
  • Posts: 599
  • Joined: 15-December 09

Re: strtotime not allowed in lambdas?

Posted 01 February 2012 - 11:00 AM

Never mind. Crap!

I just used an invalid date apparently.

The date I used was 1 Jan 1013.

The wrong date is not in the first post so that code actually does work.

Oh well, at least it works now.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1