Bug #74363 [Nab]: echo doesn't accept multiple arguments
| From: | nikic@php.net | Date: | Sun, 02 Apr 2017 13:22:21 +0000 |
| Subject: | Bug #74363 [Nab]: echo doesn't accept multiple arguments | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208286@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74363&edit=1
ID: 74363
Updated by: nikic@php.net
Reported by: olafvdspek at gmail dot com
Summary: echo doesn't accept multiple arguments
Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Debian
PHP Version: 5.6.30
Block user comment: N
Private report: N
New Comment:
Echo and parenthesis have nothing to do with each other. You can write echo("Foo") in the
same way you're allowed to write echo(((((((((("Foo")))))))))). Both are equally
pointless. The correct echo syntax is
echo "Foo".
Previous Comments:
------------------------------------------------------------------------
[2017-04-02 13:18:03] olafvdspek at gmail dot com
Could it be reclassified as feature request to allow echo to also accept multiple arguments when
parentheses are used?
If not, IMO the documentation should be improved as explained in the previous comment.
------------------------------------------------------------------------
[2017-04-02 13:01:38] dm@php.net
Not a bug, explained in manual as you've later realized.
------------------------------------------------------------------------
[2017-04-02 12:53:22] olafvdspek at gmail dot com
Grr, this seems to simple to be true.
> Additionally, if you want to pass more than one parameter to echo, the parameters must not be
> enclosed within parentheses.
> void echo ( string $arg1 [, string $... ] )
Perhaps this should be split into two lines, one without parentheses and with multiple arguments and
one with parentheses and a single argument.
Or multiple arguments should be supported in both forms..
------------------------------------------------------------------------
[2017-04-02 12:49:30] olafvdspek at gmail dot com
Description:
------------
Echo doesn't appear to accept multiple arguments
PHP 5.6.30-0+deb8u1 (cli) (built: Feb 8 2017 08:50:21)
PHP 7.0.16-3 (cli) (built: Feb 22 2017 10:03:06) ( NTS )
Test script:
---------------
<?php
echo('A', 'B');
Expected result:
----------------
AB
Actual result:
--------------
PHP Parse error: syntax error, unexpected ',' in /root/a.php on line 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74363&edit=1