How can I optimize this:
$enddatetime = date("YmdHis", strtotime(date("YmdHis", strtotime($session_date.' '.$session_time)) . " + ".$session_duration." minutes"));
eg values:
$session_date 2011-01-31
$session_time 19:30:00
$session_duration 100
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Ok, so basically you’re taking a cow, turning it into hamburger, sprinkling on a little bit of salt, then gluing the salted hamburger back into a cow yet again.
Why the repeated roundtrips through date->strtotime->date, etc…? That’s highly inefficient. PHP’s native date/time format is a Unix-style timestamp – seconds since Jan 1/1970.