Have you ever noticed developers putting backslashes (\) in front of their PHP function calls? It’s often referred to as a micro-optimization, but how could such a simple thing as a backslash improve the performance of your application? Introduced in PHP version 5.3, namespaces serve as a method to organize elements like classes and functions within an application.
Using tools like https://3v4l.org/, we can convert our function calls to opcode and see the difference with or without the backslash. Let’s start by calling a native PHP function from a namespace using a backslash prefix: namespace Foo\Bar; echo \strtoupper('Hello World'); op return operands --------------------------------- INIT_FCALL 'strtoupper' SEND_VAL 'Hello+World' DO_ICALL $0 ECHO $0