note 105576 added to function.get-declared-classes

From: Date: Mon, 29 Aug 2011 18:15:24 +0000
Subject: note 105576 added to function.get-declared-classes
Groups: php.notes 
Request: Send a blank email to php-notes+get-182812@lists.php.net to get a copy of this message
<?php class xv_test { public function test (){ return "test"; } } class xv_example { public function test (){ return "test"; } } function get_declared_classes_by_prefix($prefix = ""){ $result = array(); foreach(get_declared_classes() as $class) if($prefix == substr($class, 0, strlen($prefix))) $result[] = $class; return $result; } var_dump(get_declared_classes_by_prefix("xv_")); /* result is array 0 => string 'xv_test' (length=7) 1 => string 'xv_example' (length=10) */ ?> Search class by prefix. ---- Server IP: 69.147.83.197 Probable Submitter: 89.25.173.41 ---- Manual Page -- http://www.php.net/manual/en/function.get-declared-classes.php Edit -- https://master.php.net/note/edit/105576 Del: integrated -- https://master.php.net/note/delete/105576/integrated Del: useless -- https://master.php.net/note/delete/105576/useless Del: bad code -- https://master.php.net/note/delete/105576/bad+code Del: spam -- https://master.php.net/note/delete/105576/spam Del: non-english -- https://master.php.net/note/delete/105576/non-english Del: in docs -- https://master.php.net/note/delete/105576/in+docs Del: other reasons-- https://master.php.net/note/delete/105576 Reject -- https://master.php.net/note/reject/105576 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#182812) next »