php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77779 incorrect syntax
Submitted: 2019-03-21 18:55 UTC Modified: 2019-03-21 19:09 UTC
From: ulrich dot geiss at arcor dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 - 27 = ?
Subscribe to this entry?

 
 [2019-03-21 18:55 UTC] ulrich dot geiss at arcor dot de
Description:
------------
Hello,

on page http://php.net/manual/en/function.echo.php the syntax line "echo ( string $arg1 [, string $... ] ) : void" is incorrect.
As stated later echo is NOT a function.  If used with "(", a comma-separated argument list and ")", echo will fail (error message: [Thu Mar 21 18:41:34.397179 2019] [php7:emerg] [pid 5218] [client 192.168.0.33:62292] PHP Parse error:  syntax error, unexpected ',' in /var/www/html/album/now.php on line 9).
Please change the syntax-line to "echo string $arg1 [, string $... ]".

It took me some hours to find out the reason for the errors and to correct my php-scripts.

Thanks in advance
with kind regards

U. Geiß

Test script:
---------------
<!DOCTYPE html>
<html>
  <head>
    <title>Server clock</title>
  </head>
  <body>
<?php
  echo 'The server says: My clock shows "' , date( 'c' ) , '"' ;     // correct syntax
  echo( 'The server says: My clock shows "' , date( 'c' ) , '"' ) ;  // syntax as shown on http://php.net/manual/en/function.echo.php
?>
  </body>
</html>

Expected result:
----------------
The server says: My clock shows "2019-03-21T18:46:25+00:00" 

Actual result:
--------------

HTTP 500 error
That’s odd... the website can’t display this page
The site may be under maintenance or could have a programming error.
Try this
Go back to the last page
Try contacting the website’s owner
Report this issue

Privacy statement

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-21 19:09 UTC] salathe@php.net
-Status: Open +Status: Not a bug
 [2019-03-21 19:09 UTC] salathe@php.net
The prototypes shown in the descriptions are not supposed to be valid PHP code.  How to interpret them is detailed in "How to read a function definition" [1] section of the manual.

[1] http://php.net/manual/en/about.prototypes.php

P.S. That page was slightly up to date, with regards to how we show return types.  The update page should be available online soon.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Sep 19 09:01:24 2020 UTC