Bug #77130 [Nab]: Documentation error

From: Date: Fri, 09 Nov 2018 16:17:13 +0000
Subject: Bug #77130 [Nab]: Documentation error
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16132@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77130&edit=1 ID: 77130 User updated by: clement dot barbaza at gmail dot com Reported by: clement dot barbaza at gmail dot com Summary: Documentation error Status: Not a bug Type: Bug Package: Documentation problem Operating System: Mac OS 10.14.1 PHP Version: 7.2.12 Block user comment: N Private report: N New Comment: Yes, you are entirely right. The problem is on line 7 that corresponds at : echo "He drank some juice made of $juices."; It's my fault, I don't know why but I thought the comments described the line above and not the line under :( Previous Comments: ------------------------------------------------------------------------ [2018-11-09 16:09:29] cmb@php.net Check line 7. See https://3v4l.org/A1mQQ. ------------------------------------------------------------------------ [2018-11-09 12:59:02] clement dot barbaza at gmail dot com Hi, Thank you for your quick reply! I know there are 2 syntaxes to express the same thing, but in this case, it doesn't work :( I simply created a file and inserted the documentation code : <?php $juice = "apple"; echo "He drank some $juice juice.".PHP_EOL; // Invalid. "s" is a valid character for a variable name, but the variable is $juice. echo "He drank some juice made of $juices."; // Valid. Explicitly specify the end of the variable name by enclosing it in braces: echo "He drank some juice made of ${juice}s."; Here's the result: php -f index.php He drank some apple juice. PHP Notice: Undefined variable: juices in index.php on line 7 Notice: Undefined variable: juices in index.php on line 7 He drank some juice made of .He drank some juice made of apples.% I hope it will help you to check this documentation error. ------------------------------------------------------------------------ [2018-11-09 10:39:40] sjon at Hortensius dot net actually both are correct, so why do you think it has to be one, not the other? ------------------------------------------------------------------------ [2018-11-09 10:39:11] bwoebi@php.net This is valid syntax. Though you usually see the latter variant, it's just two syntaxes to express the same thing. ------------------------------------------------------------------------ [2018-11-09 10:32:41] clement dot barbaza at gmail dot com Description: ------------ Hello, I found an error in the documentation Strings : http://php.net/manual/en/language.types.string.php There is a problem on the documentation : echo "He drank some juice made of ${juice}s."; Instead, it has to be : echo "He drank some juice made of {$juice}s."; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77130&edit=1

« previous php.doc.bugs (#16132) next »