I like to output a lot of detail to the shell when my PHP scripts are running.
I have a lot of lines like this:
echo "
" . __method__ . " - PDF file does not exist.";
It bugs the hell out of me that there are so many s everywhere in my code. Is there a better way to do this? Is there something simple that I'm missing, perhaps?
What are some preferred ways to do this in some major php libraries?
No standard way in PHP.
But you could write a function to do that....
function shellprint($string)
{
echo($string . "
");
}
I'v tested this and other ways of doing it, but none worked.
The rusty way it works is having something like
if ($something==true)
{
echo 'Hello
This is a new line.
and this another new line';
}
I wanna have a nice indent style on my code, so I created a small function to solve it.
function shecho($text) {
$text = str_replace('
', '
', $text);
echo $text;
}
This way I will only have to write
shecho ('Hello
This is a new line.
and this another new line');
Easy stuff.
Hope it helps anyone!