Personal preferences based on readability. Choose something that will be easier for you if someone else reads your code (or you in the future) to understand.
Typically, though, if there is a lot of HTML, you wonβt want to put it in the PHP echo, and if it is short, you would. Think of the former as a template, and the latter as a method that returns an HTML fragment.
source share