Preparing for the ZEND-Exam, I found a question where a class redefined the strlen-function:
namespace MyFramework\MyString
{
function strlen ($str)
{
return \strlen($str) * 2; // return double string-length
}
}
I never came across that "\function"-thing before and could not get an explanation from my trainer - can somebody pls. help shed some light...?
It calls a function from the global namespace.
You need it only if there's a function of the same name in the current namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With