March 16, 2012I decided to start a new series called PHP Tips. I will be posting some tips and code snippets that will help people become better PHP developers. For the first one, is it better to use return or echo in your PHP functions? As you’ve probably been told, it depends on the situation. But here is a rule of thumb; if the function is only used once, then use echo. If the function is used more than once throughout the application, then it is best to use return and especially if you plan on manipulating that function before its output. If the function is actually a method within a class, you should always use return.