Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 628 Bytes

performance-tips.md

File metadata and controls

34 lines (23 loc) · 628 Bytes

Back to technical skills

Performance tips

Comparison

Don’t use loose comparison, always be as strict as possible.

// Bad:
if ($a == $b) {/* ... */}

// Good:
if ($a === $b) {/* ... */}

Using fully-qualified function calls

When calling functions in a namespaced context, additional actions are triggered in PHP which result in slower execution.

// solution 1:
namespace baz;
\foo();

// solution 2:
namespace baz;
use function foo;
foo();

References