php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #53519 a minor error in examples
Submitted: 2010-12-11 11:05 UTC Modified: 2010-12-11 20:03 UTC
From: M8R-oq0m8v at mailinator dot com Assigned: dtajchreber (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: M8R-oq0m8v at mailinator dot com
New email:
PHP Version: OS:

 

 [2010-12-11 11:05 UTC] M8R-oq0m8v at mailinator dot com
Description:
------------
---
From manual page: http://www.php.net/language.types.string
---

There is probably a documentation error in example #8:

<?php
echo "He drank some juice made of $juice[0]s.".PHP_EOL;
echo "$people->robert greeted the two $people->smiths.";
?>

outputs

He drank some juice made of s.
Robert Paulsen greeted the two .

You should use complex (curly) syntax in such cases, because you really want to output:

He drank some juice made of apples.
Robert Paulsen greeted the two Smiths.

If the author intended to show that simple syntax doesn't work in such cases, it would be better to provide comments/text explaining this:

echo "He drank some juice made of $juice[0]s.".PHP_EOL; // Invalid; s is interpreted as a part of variable name
echo "$people->robert greeted the two $people->smiths."; // Invalid; s is interpreted as a part of variable name


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-11 20:02 UTC] dtajchreber@php.net
Automatic comment from SVN on behalf of dtajchreber
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=306232
Log: Fixed bug #53519 added explicit notes that certain examples won't work
 [2010-12-11 20:03 UTC] dtajchreber@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: dtajchreber
 [2010-12-11 20:03 UTC] dtajchreber@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.


 [2020-02-07 06:08 UTC] phpdocbot@php.net
Automatic comment on behalf of dtajchreber
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=0337085f739ac7ac2208cb15d699cb21a3268db7
Log: Fixed bug #53519 added explicit notes that certain examples won't work
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 20:00:02 2026 UTC