Can I override the PHP built-in function echo()? -
I recently saw my source code and it was a real mess.
My php source:
echo & lt; H1 & gt; Rear & lt; H1 & gt; '; Echo '& lt; Span & gt; Rear & lt; / Span & gt; '; Echo & lt; P & gt; Rear & lt; / P & gt; ';
And when I look up the browser source for the provided page:
& Lt; Span & gt; R & lt; / Span & gt; & Lt; P & gt; Rar & lt; / P & gt;
There is no way to override the echo for me so that every output ends with a new line, such as some
function echo ( $ String} {echo $ string "\ r \ n"; }
is not a function, but a language statement can not be defined again Could. If you want to make your output markup attractive, please note it.
You can do , use the search / method of your IDE, and replace all echo
with the statement Echo PHP_EOL,
. This will add the OS specific newline char (s) before any output, note coma after PHP_EOL because it is important
You can output several values with echo like this:
resonant 'one', $ foo, PHP_EOL, 'two', $ bar, PHP_EOL;
So there is no need to type echo
on each line
However , I agree with anyone I suggest using more dedicated approach to isolate content and layout. Template ideas or by using here. Dr.
In the editin, there is very little profit in getting a lot of markup. If you are using tools like Firebug to inspect HTML, then you will have a correctly formatted markup, even if it is actually in spite of markup disturbances. Apart from this, on the sites with many visitors, you will often get a markup miniford, which is the opposite of what you are trying to do, just because they add all the new lines and tabs to the page weight, which would slow down Increase in page load and traffic costs
Comments
Post a Comment