php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12568 Feature Request for function is_subclass_of
Submitted: 2001-08-04 17:58 UTC Modified: 2010-12-14 12:09 UTC
From: php at nichtich dot de Assigned: jani (profile)
Status: Closed Package: Class/Object related
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
 [2001-08-04 17:58 UTC] php at nichtich dot de
unfortunately the function is_subclass_of does not accept class names in both arguments like get_parent_class since 4.0.5. it would be nice if you could use is_subclass_of in the following way:

is_subclass_of($foo,"bar")
  true if $foo is an object of a subclass of bar
  (this is how it works now)

is_subclass_of("foo","bar")
  true if foo is a subclass of bar
  (a wrote a function to do this, see my note on is_subclass_of) 

is_subclass_of("foo",$bar)
  true if foo is a subclass of the class $bar
  = is_subclass_of("foo",get_class($bar));

is_subclass_of($foo,$bar)
  true if $foo is an object of the class of $bar

thanx a lot!

Jakob

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-14 12:09 UTC] jani@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: Class/Object related -Assigned To: +Assigned To: jani
 [2010-12-14 12:09 UTC] jani@php.net
Implemented in PHP 5.0.3 it seems.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 19:01:29 2024 UTC