4 ms·
I've never really thought about it before but PHP has some very similar metaprogramming features. For starters, the incredibly dangerous runkit extension (like
by dave1010uk 13y ago
I've never really thought about it before but PHP has some very similar metaprogramming features.
For starters, the incredibly dangerous runkit extension (like importing Objective-C's runtime).
There's also the Reflection API, which provides introspection and is quite widely used.
PHP also has magic methods, such as __call(), which give the ability to handle calling a method that doesn't exist.
As others have mentioned about Objective-C, these are all nice tools to know about and understand, however using them is often a code smell and can lead to unmaintainable code.
PHP doesn't have anything like categories, which is a shame because they look really useful in cases (as long as you don't mind violating the SRP a little). PHP has traits, which are more similar to mixins in ruby than categories in Objective-C.
Oh, PHP also has eval().