What is the best method, to change the previously declared function into the new one?

for example, there is already declared:

function smth(){
echo 'aaa';
}

and i want that it displayed not aaa, but bbb

function smth(){
echo 'bbb';
}

but when i insert the new function (inside functions.php), i get error message

(Fatal error: Cannot redeclare **smth()** (previously declared in ... )

UPDATE – I have found a solution:

https://stackoverflow.com/a/8125517/2165415

3 Answers
3

PHP cannot redeclare functions. You will need to use some other approach, like filters or similar.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *