PHP has many built in functions. Normally you can’t override them. The only exception: If you’re in another namespace. But how can you then access the real function again? Simply add a backslash before the functions name and the built-in function get called.
Example:
<?php namespace test{ function phpversion(){ return "Not the real phpversion"; } echo phpversion()."<br />"; echo \phpversion()."<br />"; echo phpversion()."<br />"; } ?>
This will output something like:
Not the real phpversion
8.0.0
Not the real phpversion
Top comments (0)