note 102880 added to language.oop5.properties

From: Date: Fri, 11 Mar 2011 23:18:28 +0000
Subject: note 102880 added to language.oop5.properties
Groups: php.notes 
Request: Send a blank email to php-notes+get-177808@lists.php.net to get a copy of this message
$this can be cast to array. But when doing so, it prefixes the property names/new array keys with certain data depending on the property classification. Public property names are not changed. Protected properties are prefixed with a space-padded '*'. Private properties are prefixed with the space-padded class name... <?php class test { public $var1 = 1; protected $var2 = 2; private $var3 = 3; static $var4 = 4; public function toArray() { return (array) $this; } } $t = new test; print_r($t->toArray()); /* outputs: Array ( [var1] => 1 [ * var2] => 2 [ test var3] => 3 ) */ ?> ---- Server IP: 69.147.83.197 Probable Submitter: 65.36.73.107 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.properties.php Edit -- https://master.php.net/note/edit/102880 Del: integrated -- https://master.php.net/note/delete/102880/integrated Del: useless -- https://master.php.net/note/delete/102880/useless Del: bad code -- https://master.php.net/note/delete/102880/bad+code Del: spam -- https://master.php.net/note/delete/102880/spam Del: non-english -- https://master.php.net/note/delete/102880/non-english Del: in docs -- https://master.php.net/note/delete/102880/in+docs Del: other reasons-- https://master.php.net/note/delete/102880 Reject -- https://master.php.net/note/reject/102880 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#177808) next »