|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-12-18 17:01 UTC] helly@php.net
[2003-12-22 03:59 UTC] redeye at erisx dot de
[2003-12-22 05:39 UTC] helly@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 22:00:01 2025 UTC |
Description: ------------ Using a foreach ( or while ) loop to print the content of an object should to my understanding skip private and protected values ( or methods ). Actually these values are returned but missing their respective keys, so at least their source is hidden. Reproduce code: --------------- <pre><?php class test { private $foo = 'test foo'; private $bar = 'test bar'; protected $foobar = 'test foobar'; } $test = new test; foreach ( $test AS $key => $val ){ echo $key." => ".$val."\r\n"; } ?></pre> Expected result: ---------------- empty page :) Actual result: -------------- => test foo => test bar => test foobar