note 129067 added to language.variables.scope

From: Date: Sat, 25 Nov 2023 09:57:44 +0000
Subject: note 129067 added to language.variables.scope
Groups: php.notes 
Request: Send a blank email to php-notes+get-221021@lists.php.net to get a copy of this message
Michael Bailey (jinxidoru at byu dot net) ¶ //- Your example output behavior was changed and the static prop shared with the two classes: //- You say that: class A { function Z() { static $count = 0; printf("%s: %d\n", get_class($this), ++$count); } } class B extends A {} $a = new A(); $b = new B(); $a->Z(); $a->Z(); $b->Z(); $a->Z(); //- output: A: 1 A: 2 B: 1 A: 3 //- but output it's exactly as following [PHPv8.2]: A: 1 A: 2 B: 3 A: 4 //- Thanks :) ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 45.242.118.107) ---- Manual Page -- https://php.net/manual/en/language.variables.scope.php Edit -- https://main.php.net/note/edit/129067 Del: integrated -- https://main.php.net/note/delete/129067/integrated Del: useless -- https://main.php.net/note/delete/129067/useless Del: bad code -- https://main.php.net/note/delete/129067/bad+code Del: spam -- https://main.php.net/note/delete/129067/spam Del: non-english -- https://main.php.net/note/delete/129067/non-english Del: in docs -- https://main.php.net/note/delete/129067/in+docs Del: other reasons-- https://main.php.net/note/delete/129067 Reject -- https://main.php.net/note/reject/129067 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221021) next »