note 125389 added to function.get-object-vars
| From: | iluxaorlov at yandex dot ru | Date: | Wed, 23 Sep 2020 13:58:01 +0000 |
| Subject: | note 125389 added to function.get-object-vars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215462@lists.php.net to get a copy of this message | ||
When we use typed properties that was never set and not initialized:
<?php
class Test
{
public string $notInitialized;
}
$test = new Test();
$vars = get_object_vars($test);
var_dump($vars); // array(0) { }
?>
But:
<?php
class Test
{
public $notTyped;
public string $initialized = '';
}
$test = new Test();
$vars = get_object_vars($test);
var_dump($vars); // array(2) { ["notTyped"]=> NULL ["string"]=> string(0)
"" }
?>
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.172 (proxied: 92.39.133.150)
----
Manual Page -- http://php.net/manual/en/function.get-object-vars.php
Edit -- https://master.php.net/note/edit/125389
Del: integrated -- https://master.php.net/note/delete/125389/integrated
Del: useless -- https://master.php.net/note/delete/125389/useless
Del: bad code -- https://master.php.net/note/delete/125389/bad+code
Del: spam -- https://master.php.net/note/delete/125389/spam
Del: non-english -- https://master.php.net/note/delete/125389/non-english
Del: in docs -- https://master.php.net/note/delete/125389/in+docs
Del: other reasons-- https://master.php.net/note/delete/125389
Reject -- https://master.php.net/note/reject/125389
Search -- https://master.php.net/manage/user-notes.php