note 119920 added to language.namespaces.importing

From: Date: Tue, 20 Sep 2016 11:18:49 +0000
Subject: note 119920 added to language.namespaces.importing
Groups: php.notes 
Request: Send a blank email to php-notes+get-206635@lists.php.net to get a copy of this message
To clarify the distinction between inserting a trait in a class and importing a trait in a namespace, here is an example where we first import and then insert a trait. <?php namespace ns1; trait T { static $a = "In T"; } namespace ns2; use ns1\T; // Importing the name of trait ns1\T in the namespace ns2 class C { use T; // Inserting trait T in the class C, making use of the imported name. } namespace main; use ns2\C; echo C::$a; // In T; ---- Server IP: 72.52.91.14 Probable Submitter: 198.251.62.95 ---- Manual Page -- http://php.net/manual/en/language.namespaces.importing.php Edit -- https://master.php.net/note/edit/119920 Del: integrated -- https://master.php.net/note/delete/119920/integrated Del: useless -- https://master.php.net/note/delete/119920/useless Del: bad code -- https://master.php.net/note/delete/119920/bad+code Del: spam -- https://master.php.net/note/delete/119920/spam Del: non-english -- https://master.php.net/note/delete/119920/non-english Del: in docs -- https://master.php.net/note/delete/119920/in+docs Del: other reasons-- https://master.php.net/note/delete/119920 Reject -- https://master.php.net/note/reject/119920 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206635) next »