I would like to override the _() PHP function so that it supports one or more arguments. Is it possible to do that using PHP code?
I would like to override the _() PHP function so that it supports one
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is possible, using the Runkit extension.
However, it’s generally not considered a good idea, except for use with things like unit testing, where you may want to isolate some of your functionality.
For general use, you shouldn’t be overriding built-in functions because it makes your code harder to maintain, and opens you up to some very hard to debug issues.
Also, the Runkit extension is marked as ‘experimental’, which means it really shouldn’t be used in a production system.