php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #34993 instanceof documentation & inheritance
Submitted: 2005-10-26 18:37 UTC Modified: 2005-11-03 11:18 UTC
From: graced at monroe dot wednet dot edu Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2005-10-26 18:37 UTC] graced at monroe dot wednet dot edu
Description:
------------
The documentation for the instanceof operator in the manual does not authoritatively say that the operator checks parent classes and interfaces as well as the base clase, i.e.

class A { }
class B extends A { } 

$thing = new B;


if ($thing instanceof A) { 
    echo 'A'; 
}
if ($thing instanceof B) {
    echo 'B';
}
// result: AB
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-03 11:18 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"instanceof is used to determine whether a given object, his parents or their implemented interfaces are of a specified object class."
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Nov 20 12:00:01 2025 UTC