The best way is to set up xdebug and hook it to your IDE (e.g Visual Studio Code). Then you don't have to echo your output at all, plus you can watch your variables and step through functions. But perhaps you are unable to install a debugger or remote debugger for your own reasons.
You can always just write your own logger using `file_put_contents('some.log', print_r($some_variable,true).PHP_EOL, FILE_APPEND);` or similar.
You can always just write your own logger using `file_put_contents('some.log', print_r($some_variable,true).PHP_EOL, FILE_APPEND);` or similar.