开发者

PHP date_add is alias of DateTime::add, but who calls who internally?

开发者 https://www.devze.com 2023-03-08 11:37 出处:网络
Like date_add there are many functions date_diff, date_format etc having a corresponding alias in DateTime class.

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".
0

精彩评论

暂无评论...
验证码 换一张
取 消