Reputation: 2039
Is the source code of the predefined PHP classes (eg Execption
, PDO
, etc) available somewhere?
I tried printing the source code of the classes via PHP, but it did not work for predefined classes (probably because the source files don't actually exist on my system?).
The reason why I want the source is that I want to know what and how exactly some methods do what they do (for example, what __wakeup
does for PDO
).
Upvotes: 0
Views: 213
Reputation: 1914
If you really want to see the source of the respective classes, I would just go to the php.net website and download the source code of PHP.
There might just as well be that those classes were not even wrote in PHP.
But do you really need to see the source code of those classes?
In case you want to know what __wakeup() does for PDO, shouldn't you rather read the PHP documentation for magic methods ?
It says there
The intended use of __wakeup() is to reestablish any database connections that may have been lost during serialization and perform other reinitialization tasks.
Upvotes: 1
Reputation: 8855
It's not possible to print out the php source code of those classes as they habe never been written in php. Instead you could have a look at the c sources: https://github.com/php/php-src
Upvotes: 2