On Sat, 02 Mar 2019 22:15:49, johannes schlueters wrote:
PHP's echo has the option already:

echo $foo, PHP_EOL;

not much difference i effort to writing

print $foo, true;

except that the code is explicit.

my request was not "how to print a newline with PHP". the request is for PHP to
implement a builtin method that prints a newline *by default*. currently no
method exists that i know of.

function println($a) {
echo $a, PHP_EOL;
}

Can easily be done in library.

again not a builtin.

4. introduce a new variable, perhaps "$OUTPUT_RECORD_SEPARATOR", "$ORS", "$\"
or similar, that controls output record separator

Such magic is hard to debug and easily leads to bugs in user code.

you post this without recognizing that Perl and Ruby already have this for many
years.

While sometimes having a shortcut at hand is nice, next request will be
to automatically add a "<br>" as we often produce HTML and thn the ex
request and next and this becomes messy and making everything harder
for very little benefit.

at least 5 other popular programming languages implement this already, and have
for many years. its even part of the POSIX standard:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/puts.html

so at a minimum it should be implemented as part of PHP POSIX:

http://php.net/ref.posix


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to