[Solved] Why echo dont show my string?


A function cannot be public unless it is part of a class. Remove that keyword and it works.

Although I shall add that your code is a bit confusing. You will either want to have a function that prints something or a function that returns something and is assigned to a variable. You’re doing a mix of the two. As suggested otherwise, I would recommend replacing the ‘echo’ with a ‘return’.

solved Why echo dont show my string?