PHP has a very rich set of built-in functions. In general,
using an appropriate built-in function is more efficient than trying to
implement the same functionality in PHP manually.
An example of this is the date function. I have seen
several instances where a developer has tried to output a date by first
constructing an array with the getdate function. Then, to
generate the required output, the developer accesses the various elements
of the array.
In this instance, the developer could have used the date function to
format date and time strings with just one call to a built-in function.
When you want to output date strings, use the power of the
date function instead of trying to code the logic manually.
Similarly, when implementing code to perform a
fairly common task, take a few minutes to review the PHP manual.
You might find a built-in function that you can use instead.