php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71878 Error in documentation example
Submitted: 2016-03-22 09:43 UTC Modified: 2016-03-23 11:15 UTC
From: alexis_advance at hotmail dot com Assigned: cmb (profile)
Status: Closed Package: Scripting Engine 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: alexis_advance at hotmail dot com
New email:
PHP Version: OS:

 

 [2016-03-22 09:43 UTC] alexis_advance at hotmail dot com
Description:
------------
---
From manual page: http://www.php.net/language.types.string
---

The example right below "It is also possible to access class properties using variables within strings using this syntax." does not work as expected.

Test script:
---------------
Note: I just copied and pasted this script from the documentation.

<?php
class foo {
    var $bar = 'I am bar.';
}

$foo = new foo();
$bar = 'bar';
$baz = array('foo', 'bar', 'baz', 'quux');
echo "{$foo->$bar}\n";
echo "{$foo->$baz[1]}\n";
?>

Expected result:
----------------
I am bar.
I am bar.

Actual result:
--------------
I am bar. 
Notice: Array to string conversion in (filepath) on line 10

Notice: Undefined property: foo::$Array in (filepath) on line 10

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-22 09:47 UTC] requinix@php.net
-Package: Documentation problem +Package: Scripting Engine problem
 [2016-03-22 09:47 UTC] requinix@php.net
https://3v4l.org/UpA4M

Needs to be updated for PHP 7's changes.
 [2016-03-23 11:14 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=338787
Log: fixed #71878 (Error in documentation example)
 [2016-03-23 11:15 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2016-03-23 11:15 UTC] cmb@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.
 [2016-03-23 21:02 UTC] alexis_advance at hotmail dot com
Thanks for you, requinix@php.net and cmb@php.net

Regards.
 [2020-02-07 06:07 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=27c99098edc99184811dad0f119f57d244c86134
Log: fixed #71878 (Error in documentation example)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 10:00:01 2026 UTC