> Hi Tyson,
>
> I like this proposal, but why is the main argument optional? Wouldn't it
> make sense to always require a string as an argument?
>
> Regards,
> Kamil
I initially considered making it required, but then I felt like there wasn't a
compelling reason to force end users
to write `println('')` instead of `println()` to print a single newline in code
surrounded by other println statements.
Printing an empty blank line would be common enough in CLI output or plaintext
HTTP responses for this proposal to make it easier to do.
- This differs from echo/print/printf statements, where not including an
argument wouldn't make sense to support, because it would not output anything
- This proposed println behavior is similar to python, where `print()` with no
arguments would print a single newline
https://wiki.php.net/rfc/println#proposal
```
println("test");
println(); // moderately useful to not switch to echo or pass the empty string
to print a blank line
println("third line");
/*
Output:
test
third line
*/
```
Thanks,
- Tyson
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php