in Education by
I have this code in php that I could not run in PHP 5.2.9 please give me an Idea to convert this code to work on PHP 5.2.9 Thanks, $startTime = new DateTime(date('h:i:s a')); $endTime = new DateTime("3:00:00 pm"); $timeTaken = $endTime->diff($startTime); $timeTaken = $timeTaken->format('%h hour, %i mins, %s sec'); JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
There isn't a built-in equivalent for date->diff in PHP 5.2, so you'll have to write your own. Fortunately, the PHP manual has comments where people have done the hard work for you. See http://php.net/manual/en/function.date-diff.php, scroll down to the comments, and pick your favourite solution (there are several to choose from). The other solution is simply to bite the bullet and upgrade -- PHP 5.2 is no longer supported, so you really should be considering upgrading.

Related questions

0 votes
    I have this code in php that I could not run in PHP 5.2.9 please give me an Idea to convert ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    The digits 1,2,3,4,5,6,7,8 and 9 are written in random order to form a nine digit number. The probability that this ... 2 9 2 D. 7 9 7 Select the correct answer from above options...
asked Nov 15, 2021 in Education by JackTerrance
0 votes
    regmatches(number, gregexpr(pattern = “2.?2”,text = number)) Is this an example of non-greedy quantifier? If yes, then why and what would be the equivalent greedy quantifier?...
asked Oct 16, 2020 in Technology by JackTerrance
0 votes
    For the function F (s) = (s^2+s+1)/s(s+5)(s+3), after splitting this function into partial fractions ... Questions for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 16, 2021 in Education by JackTerrance
0 votes
    For the function F (s) = (s+5)/s(s^2+2s+5), after splitting this function into the partial fractions, ... Questions for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 16, 2021 in Education by JackTerrance
0 votes
    _____________ will produce a sequential vector c( (1,2,3,4,5,6,7,8,9)). (a) Seq(9) (b) Seq ... Functions and Debugging of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    >>> list(range(0, -9,-1)) will print [-1, -2, -3, -4,-5, -6, -7, -8) [0,-1, -2, -3, -4,-5, -6, -7, -8 ... [0,-1, -2, -3, -4,-5, -6, -7] Select the correct answer from above options...
asked Dec 28, 2021 in Education by JackTerrance
0 votes
    write the steps to search the 13 from the following element using binary search 2,4,5,8,9,11,12,13,15,18,21,22,25,29,30 Select the correct answer from above options...
asked Dec 13, 2021 in Education by JackTerrance
...