php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #33968 Little error in echo's manual page
Submitted: 2005-08-02 16:19 UTC Modified: 2005-08-09 19:39 UTC
From: colder@php.net Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: colder@php.net
New email:
PHP Version: OS:

 

 [2005-08-02 16:19 UTC] colder@php.net
Description:
------------
There is a little error in "Example 1. echo() examples" block.

###
// Because echo is not a function, following code is invalid.
($some_var) ? echo 'true' : echo 'false';

// However, the following examples will work:
($some_var) ? print('true'): print('false'); // print is a function
###

The problem is that print is not a function. Its not really a matter of "It doesn't work because its a language construct".

Here are the patches en+fr:

Index: en/reference/strings/functions/echo.xml
===================================================================
RCS file: /repository/phpdoc/en/reference/strings/functions/echo.xml,v
retrieving revision 1.15
diff -u -r1.15 echo.xml
--- en/reference/strings/functions/echo.xml	23 Nov 2004 09:38:18 -0000	1.15
+++ en/reference/strings/functions/echo.xml	2 Aug 2005 14:10:41 -0000
@@ -67,11 +67,11 @@
 line with just a semicolon. no extra whitespace!
 END;
 
-// Because echo is not a function, following code is invalid. 
+// Because echo does not behave like a function, following code is invalid. 
 ($some_var) ? echo 'true' : echo 'false';
 
 // However, the following examples will work:
-($some_var) ? print('true'): print('false'); // print is a function
+($some_var) ? print 'true': print 'false'; // print behaves like a function
 echo $some_var ? 'true': 'false'; // changing the statement around
 ?>
 ]]>

Index: fr/reference/strings/functions/echo.xml
===================================================================
RCS file: /repository/phpdoc-fr/reference/strings/functions/echo.xml,v
retrieving revision 1.22
diff -u -r1.22 echo.xml
--- fr/reference/strings/functions/echo.xml	5 Jul 2005 21:05:27 -0000	1.22
+++ fr/reference/strings/functions/echo.xml	2 Aug 2005 14:13:03 -0000
@@ -73,11 +73,11 @@
 de plus !
 END;
 
-// comme echo() n'est pas une fonction, le code suivant n'est pas valide
-($some_var) ? echo('Oui') : echo('Non');
+// comme echo() ne se comporte pas comme une fonction, le code suivant n'est pas valide
+($some_var) ? echo 'Oui' : echo 'Non';
 
 // Cependant, les lignes suivantes sont valides :
-($some_var) ? print('Oui') : print('Non'); // print est une fonction
+($some_var) ? print 'Oui' : print 'Non'; // print se comporte comme une fonction.
 echo $some_var ? 'Oui' : 'Non';
 ?>
 ]]>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-04 09:17 UTC] sniper@php.net
Stupid example, why would you do that when you can do this:

echo ($some_var) ? 'true' : 'false';

:)

 [2005-08-04 09:17 UTC] sniper@php.net
..and it was already mentioned in the docs too.. ISC..
 [2005-08-09 19:39 UTC] sean@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

changed it to your liking..
didn't touch the french

S

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Nov 19 11:00:01 2025 UTC