Like date_add
there are many functions date_diff
, date_format
etc having a corresponding alias in DateTime
class.
开发者_Go百科Do you know if internally DateTime::add
calls date_add
or vice versa?
And just to make sure: is DateTime
class compiled internally in PHP, isn't' it? I mean when I call DateTime
class, am I calling code that does not need to be parsed 1st by PHP like one of my .php file?!
The DateTime extension is written in C. Consequences are:
- It's loaded before execution of any PHP script. So answer is no, it doesn't need to be parsed by the engine.
- C obviously doesn't support objects. Classes are usually mocked upon structs and functions. So DateTime::add translates to date_add with according reference to the "object".
精彩评论