php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15211 println?
Submitted: 2002-01-24 13:36 UTC Modified: 2003-02-06 21:08 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dark_panda at hushmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.1.1 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dark_panda at hushmail dot com
New email:
PHP Version: OS:

 

 [2002-01-24 13:36 UTC] dark_panda at hushmail dot com
I'm in the midst of doing quite a bit of shell/command line 
stuff with PHP, and I think it would be kind of useful to 
have a println construct, much like in Java or a number of 
other languages. println is identical to print, but a 
newline/carriage return is appended to the output. 

I know I could just write function in PHP or even a 
function in an extension to provide the same functionality, 
but it might as well be in the language itself, if only 
because it may be used often enough to warrant inclusion. 
(I know I'd use it all the time.) 

I started trying to add it myself (I can see that it would 
go in the Zend engine, correct?) but after reminding myself 
that I've never used Lex before (nor really looked at the 
Zend code) I decided that this would be best left to 
someone who actually knows what they're doing when it 
comes to the Zend engine.

The only problem I can think of is portability, 
specifically the oft-cursed differences between OS newline 
sequences. (Is it \n? \r\n? \n\r? Dammit?!) Doesn't seem 
like a huge issue, though, does it?

J

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-08 10:38 UTC] bigredlinux at yahoo dot com
Actually, what would be HUGE is if println could determine the sapi module it is running as and then add the endline appropriately, meaning for the web it would add a '<br clear="all" />' tag after the line.

But honestly, if php is really going to be considered for commandline scripting, it needs a println() feature.
 [2003-02-06 21:08 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Given the number of print functions already in PHP this seem pointless, especially considering it'd only print a single character.
 [2010-07-13 21:12 UTC] php at guerrillamailblock dot com
ugly:
echo "hello world\n";        # bad practice to use double quotes everywhere
echo 'hello world', "\n";    # why do I have to write >>, "\n"<<?
echo 'hello world', PHP_EOL; # oh boy

nice:
echoln 'hello world';

Same thing goes for println.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 17:01:28 2024 UTC