Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3387 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6856 invoked from network); 12 Jul 2003 16:10:37 -0000 Received: from unknown (HELO smtp2.ex.eclipse.net.uk) (212.104.129.133) by pb1.pair.com with SMTP; 12 Jul 2003 16:10:37 -0000 Received: from 10.0.0.1 (unknown [213.152.58.41]) by smtp2.ex.eclipse.net.uk (Postfix) with ESMTP id C8E4C88030; Sat, 12 Jul 2003 17:10:36 +0100 (BST) Reply-To: hudzilla@php.net To: Alan Knowles Date: Sat, 12 Jul 2003 17:10:10 +0100 User-Agent: KMail/1.5 Cc: internals@lists.php.net References: <200307121114.39525.hudzilla@php.net> <3F10035D.7040004@akbkhome.com> In-Reply-To: <3F10035D.7040004@akbkhome.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200307121710.10661.hudzilla@php.net> Subject: Re: [PHP-DEV] Fwd: Re: [PHP] Private and protected variables in PHP 5? From: hudzilla@php.net (Paul Hudson) Alan, > I think what you are getting at is that you can set 'private' variable > from outside.. - with no warnings etc. Yup. > so if you want a warning when you set/create a variable with the same > name as the private - use protected... > Or am I missing the point on what you expected..? I was expecting setting a private variable to error out. Protected works as you say - it errors out as expected. But surely private should error also - inherited classes inherit private variables, but they can't manipulate them (or at least so I thought). This code: Name = "Poppy"; var_dump($mydog); ?> Outputs this: object(poodle)#1 (2) { [""]=> NULL ["Name"]=> string(5) "Poppy" } I'm not sure what the [""]=>NULL is, but it isn't there if I shift $Name into the poodle class and make it public. --Paul