Note that there are some explanatory texts on larger screens.

plurals
  1. USJacob Courtneay
    primarykey
    data
    text
    plurals
    1. COIf you want hours just add `$hours = floor($minutes / 60); $minutes %= 60;`. I gave him exactly what he asked for in one line, the other answer is over 15 lines and handles details like string padding. If we really want to be "correct", we shouldn't be doing any of this, since [this functionality is in the standard library](http://www.php.net/manual/en/dateinterval.format.php) since PHP 5.3.
      singulars
    2. COOf course that version check is faster than compilation. To do anything with the comparison test, it will need to import (compile) code, not just make two assignments. For Python 2.5, the exception check is actually slightly faster (3.47s vs 3.87s on my machine with 1,000,000 iterations through timeit). However on 2.4, the exception check is approximately 30 times slower due to catching the SyntaxError every time. The version check is obviously better, but your example doesn't show the real reason why. =)
      singulars
    3. CO`bcmod` takes the modulus to an arbitrary precision. Basically, `bcmod($a, $b)` means `$a % $b`. Functions beginning with bc- are from the BCMath extension. They allow you to perform arbitrary-precision calculations. Unless your needs call for microsecond resolution (which I doubt), there's not much point in it. Besides, these functions store the numbers as a string, so when you do ordinary division they will be cast to ordinary types and you'll lose the precision.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload