phpDocumentor phpDocumentor
[ class tree: phpDocumentor ] [ index: phpDocumentor ] [ all elements ]
Prev Next
@static

@static

Document a static class or method

by Gregory Beaver
Tag Documentation written by cellog@php.net
Copyright 2002, Gregory Beaver
(phpDocumentor 1.1+)
@static

Description

Use the @static tag to declare a method or class to be static. Static elements can be called without reference to an instantiated class variable, as in class::method().

Example

Here's an example:

  1. /**
  2.  * example of basic @static usage in a class
  3.  * Use this if every single method is static
  4.  * @static
  5.  */
  6. class mystaticclass
  7. {
  8.    function function1($baz)
  9.    {
  10.    ...
  11.    }
  12.    
  13.    function function2()
  14.    {
  15.    ...
  16.    }
  17. }
  18.  
  19. /**
  20.  * example of a class with a single static method
  21.  */
  22. class myclass
  23. {
  24.    /**
  25.     * @static
  26.     */
  27.    function mystaticfunction()
  28.    {
  29.    ...
  30.    }
  31. }
  32.  
  33. // example of usage of static methods
  34. mystaticclass::function1();
  35. mystaticclass::function2();
  36.  
  37. myclass::mystaticfunction();

Prev Up Next
@since phpDocumentor tags @staticvar

Documentation generated on Tue, 24 Oct 2006 09:20:12 -0500 by phpDocumentor 1.3.1