Class method info: is static, is final, is constructor, return references : Reflection Class Methods « Class « PHP

PHP
1. Chart
2. Class
3. Components
4. Cookie Session
5. Data Structure
6. Design Patterns
7. Development
8. Email
9. File Directory
10. Form
11. Functions
12. Graphics Image
13. HTML
14. Language Basics
15. Login Authentication
16. Math
17. MySQL Database
18. Network
19. String
20. Web Services SOAP WSDL
21. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
PHP » Class » Reflection Class Methods 
Class method info: is static, is final, is constructor, return references

<?php
class Person {
    private $name;    
    private $age;    
    private $id;    

    function __construct$name, $age ) {
        $this->name = $name;
        $this->age = $age;
    }

    function setId$id ) {
        $this->id = $id;
    }
    
    function getId(){
        echo "get id method";    
    }
    
    function __clone() {
        $this->id = 0;
    }
}
$prod_class = new ReflectionClass'Person' );
$methods = $prod_class->getMethods();

foreach $methods as $method ) {
  print methodData$method );
  print "\n----\n";
}

function methodDataReflectionMethod $method ) {
  $details = "";
  $name = $method->getName();
  if $method->isStatic() ) {
    $details .= "$name is static\n"
  }
  if $method->isFinal() ) {
    $details .= "$name is final\n"
  }
  if $method->isConstructor() ) {
    $details .= "$name is the constructor\n"
  }
  if $method->returnsReference() ) {
    $details .= "$name returns a reference (as opposed to a value)\n"
  }
  return $details;
}

?>


           
       
Related examples in the same category
1. get_class_methods
2. is_callable: is method callable
3. in_array
4. Call class method dynamically
5. method_exists
6. Get Class method: file name, start line and end line
7. Class method info: is User Defined, is Internal, is Abstract
8. Class method info: is private, is public, is protected
ww___w_.___j___a_v_a2___s___.___c__o___m | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.