note 112466 added to function.trait-exists

From: Date: Wed, 19 Jun 2013 14:20:27 +0000
Subject: note 112466 added to function.trait-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-195285@lists.php.net to get a copy of this message
<?php trait World { private static $instance; protected $tmp; public static function World() { self::$instance = new static(); self::$instance->tmp = get_called_class().' '.__TRAIT__; return self::$instance; } } if ( trait_exists( 'World' ) ) { class Hello { use World; public function text( $str ) { return $this->tmp.$str; } } } echo Hello::World()->text('!!!'); // Hello World!!! ---- Server IP: 69.147.83.199 Probable Submitter: 109.205.248.99 ---- Manual Page -- http://php.net/manual/en/function.trait-exists.php Edit -- https://master.php.net/note/edit/112466 Del: integrated -- https://master.php.net/note/delete/112466/integrated Del: useless -- https://master.php.net/note/delete/112466/useless Del: bad code -- https://master.php.net/note/delete/112466/bad+code Del: spam -- https://master.php.net/note/delete/112466/spam Del: non-english -- https://master.php.net/note/delete/112466/non-english Del: in docs -- https://master.php.net/note/delete/112466/in+docs Del: other reasons-- https://master.php.net/note/delete/112466 Reject -- https://master.php.net/note/reject/112466 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195285) next »