Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104546 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68344 invoked from network); 3 Mar 2019 01:28:22 -0000 Received: from unknown (HELO mail.experimentalworks.net) (84.19.169.162) by pb1.pair.com with SMTP; 3 Mar 2019 01:28:22 -0000 Received: from kuechenschabe.fritz.box (ppp-188-174-116-194.dynamic.mnet-online.de [188.174.116.194]) by mail.experimentalworks.net (Postfix) with ESMTPSA id 7FECE4663F; Sat, 2 Mar 2019 23:15:50 +0100 (CET) Message-ID: <1551564949.15396.24.camel@schlueters.de> To: Steven Penny , internals@lists.php.net Date: Sat, 02 Mar 2019 23:15:49 +0100 In-Reply-To: <5c7ae08d.1c69fb81.29486.402d@mx.google.com> References: <5c7ae08d.1c69fb81.29486.402d@mx.google.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] print with newline From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Sa, 2019-03-02 at 11:59 -0800, Steven Penny wrote: > 1. Modify one or more of "print", "print_r", "var_export" such that > they produce >    a newline by default This is a break of backwards compatibility in a bad way. This breaks people doing specific output. > 2. Modify one or more of "print", "print_r", "var_export" such that > they have an >    argument similar to Python "end" that controls what follows the > input, if >    anything: > >    https://docs.python.org/library/functions.html#print 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. > 3. Add a new method, perhaps "echoln", "println", "say" or similar, > that outputs >    a newline by default function println($a) {     echo $a, PHP_EOL; } Can easily be done in library. > 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. While sometimes having a shortcut at hand is nice, next request will be to automatically add a "
" as we often produce HTML and thn the ex request and next and this becomes messy and making everything harder for very little benefit. johannes