PHPackages                             roave/function-fqn-replacer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. roave/function-fqn-replacer

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

roave/function-fqn-replacer
===========================

Replaces relative references to internal functions with absolute references

158908[3 issues](https://github.com/Roave/FunctionFQNReplacer/issues)[1 PRs](https://github.com/Roave/FunctionFQNReplacer/pulls)PHP

Since Feb 13Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Roave/FunctionFQNReplacer)[ Packagist](https://packagist.org/packages/roave/function-fqn-replacer)[ RSS](/packages/roave-function-fqn-replacer/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Function FQN Replacer
=====================

[](#function-fqn-replacer)

This utility provides a way to replace relative references of functions in function calls with absolute references.

Rationale
---------

[](#rationale)

As explained in [this twitter convo](https://twitter.com/Ocramius/status/811504929357660160) and [this article](https://veewee.github.io/blog/optimizing-php-performance-by-fq-function-calls/), PHP is resolving relative function references at call time.

This is relatively normal, as PHP, by design, cannot make decisions on which file defines which functions, because all opcode caching is local to single scripts, and not to a project.

In addition to that, PHP can only apply optimizations about internal function calls when those calls happen either in the global namespace, or are fully qualified name (FQN) calls.

Here's an example of the opcodes generated for an `call_user_func()` call without and with FQN reference:

```
