ID:               33968
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Documentation problem
 Operating System: Irrelevant
 PHP Version:      Irrelevant
 New Comment:

..and it was already mentioned in the docs too.. ISC..


Previous Comments:
------------------------------------------------------------------------

[2005-08-04 09:17:04] [EMAIL PROTECTED]

Stupid example, why would you do that when you can do this:

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

:)


------------------------------------------------------------------------

[2005-08-02 16:19:34] [EMAIL PROTECTED]

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';
 ?>
 ]]>




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33968&edit=1

Reply via email to