|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-03-17 16:21 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2014-03-17 16:21 UTC] requinix@php.net
[2014-03-18 06:35 UTC] daniel dot chobe at nextiraone dot eu
[2014-03-18 16:26 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 13:00:02 2025 UTC |
Description: ------------ The __set Magic Method will be called only one time if the variable is not defined. If the variable defined, __set will not called anymore, but the value is changed. See Example. Test script: --------------- <?php class test { public function __set($name, $value) { echo "Set $name to $value" . PHP_EOL; $this->$name = $value; } } $test = new test(); $test->foo = 1; echo 'Foo: ' . $test->foo . PHP_EOL; $test->foo = 2; echo 'Foo: ' . $test->foo . PHP_EOL; Expected result: ---------------- Set foo to 1 Foo: 1 Set foo to 2 Foo: 2 Actual result: -------------- Set foo to 1 Foo: 1 Foo: 2