2. PHP4 Class Modeling Rules

2.1. Class Signature

  • There are no visibilities for Class Signature

2.2. Class Attributes

  • There are no visibilities for Class Attributes

  • Tagged values supported:

    1. Heredoc

      Tagged value = '<<<', with value = 'true'

      Will return anything typed in the initial value with Heredoc string type.

      For example:

      $str = <<<EOD
      Example of string
      spanning multiple lines
      using heredoc syntax.
      EOD;

2.3. Class Operations

  • There are no visibilities for Class Operations

  • Tagged values supported:

    1. Parameter initial value

      Tagged value= 'initval', with value = (specified parameter initial value).

      For example:

      class ConstructorCart extends Cart {
         function ConstructorCart($item = "10", $num = 1) {
            $this->add_item ($item, $num);
         }
      }
    2. Parameter passed by reference

      Tagged value='&' with value='true' in the parameter signature.

      For example:

      <?php function foo (&$var)
         { 
            $var++; 
         }
         
         $a=5; foo ($a); 
         // $a is 6 here 
      ?>
    3. Function returns a reference

      Tagged value='&' with value='true' in the operation signature.

      For example:

      <?php function &returnsReference()
         {
            return $someref; 
         } 
      
         $newref =& returnsReference();
      ?>