downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ReflectionClass::isInterface> <ReflectionClass::isInstance
Last updated: Fri, 20 Nov 2009

view this page in

ReflectionClass::isInstantiable

(PHP 5)

ReflectionClass::isInstantiableChecks if instantiable

Descrierea

public bool ReflectionClass::isInstantiable ( void )

Checks if the class is instanciable.

Avertizare

Această funcţie nu este documentată în prezent; este disponibilă numai lista sa de argumente.

Parametri

Această funcţie nu are parametri.

Valorile întroarse

Întoarce valoarea TRUE în cazul succesului sau FALSE în cazul eşecului.

Exemple

Example #1 ReflectionClass::isInstantiable example

<?php
class { }

interface 
iface {
    function 
f1();
}

class 
ifaceImpl implements iface {
    function 
f1() {}
}

abstract class 
abstractClass {
    function 
f1() { }
    abstract function 
f2();
}

class 
extends abstractClass {
    function 
f2() { }
}

$classes = array("C""iface""ifaceImpl""abstractClass""D");

foreach(
$classes  as $class ) {
    
$reflectionClass = new ReflectionClass($class);
    echo 
"Is $class instantiable?  ";
    
var_dump($reflectionClass->IsInstantiable()); 
}

?>

Exemplul de mai sus va afişa:

Is C instantiable?  bool(true)
Is iface instantiable?  bool(false)
Is ifaceImpl instantiable?  bool(true)
Is abstractClass instantiable?  bool(false)
Is D instantiable?  bool(true)

Vedeţi de asemenea



add a note add a note User Contributed Notes
ReflectionClass::isInstantiable
There are no user contributed notes for this page.

ReflectionClass::isInterface> <ReflectionClass::isInstance
Last updated: Fri, 20 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites