10. Looks confusing, but this is...
● how PHP works
● cool for debugging purposes
● visualizing code complexity
● helpful trying to understand opcaches like
11. Try it with your code
12. So this is about profiling?
13. No! XHProf is about profiling
● XHProf is a function-level hierarchical
profiler for PHP
● Reports timing information for every function
● C-Extension can be loaded via PECL
● GUI and libs available
14. Looks like this
15. Try it with your code
16. Compiling at runtime is slow!
17. OpCode Cache
● Performance enhancing extension for PHP
● Hooking into the execution life-cycle
● Caching the results of the compilation phase
for later reuse
● HipHop Virtual Machine
● Designed for executing PHP programs
● Predecessor HPHPc makes C out of PHP
● Uses a just-in-time (JIT) compilation
20. Kidding me?
● Namespaces in PHP are just class-prefixes
● They are added to each classname by the
● The result is called a FQCN - Fully Qualified
22. What do you think of copy &
23. What do you think of traits?
24. Cool. Traits are for...
● Code reusage
● Multiple inheritance
● Keeping stuff you often use in different
● No need for complex OOP architectures
28. No. Because traits are...
● Copied into every single class at compile-
● Therefore not runtime bindable
● Not testable
● Tightly coupled
● Make it easier to cross SRP (one god-class)
29. (traits === copy & paste)
30. Wanna read more?
● PHP at the Core: A Hacker's Guide
● PHP Compiler Internals
● PHP OpCodes
● PHP Internals
● Are Traits The New Eval?
31. So you’re telling me not to use
such cool features in PHP?
Just be aware of how
things work in PHP
while writing code