Doc #71878 [Opn]: Error in documentation example

From: Date: Tue, 22 Mar 2016 09:47:25 +0000
Subject: Doc #71878 [Opn]: Error in documentation example
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13337@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71878&edit=1 ID: 71878 Updated by: requinix@php.net Reported by: alexis_advance at hotmail dot com Summary: Error in documentation example Status: Open Type: Documentation Problem -Package: Documentation problem +Package: Scripting Engine problem PHP Version: Irrelevant Block user comment: N Private report: N New Comment: https://3v4l.org/UpA4M Needs to be updated for PHP 7's changes. Previous Comments: ------------------------------------------------------------------------ [2016-03-22 09:43:37] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71878&edit=1

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