PHP Classes

File: example2.php

Recommend this page to a friend!
  Classes of Benjamin Falk  >  StructObject  >  example2.php  >  Download  
File: example2.php
Role: Example script
Content type: text/plain
Description: Creating your own Class by extending StructObject
Class: StructObject
Create objects from list of strict type variables
Author: By
Last change: ...
Date: 12 years ago
Size: 969 bytes


Class file image Download
    ** Let's use StructObject directly in a new object
    //Load the struct-file
require_once 'Struct.php';
//Create your own class and extend it with StructObject
class MyClass extends StructObject
        ** properties:
        ** title:string
        ** content:string
        ** count:integer
        ** The output of the properties
public function output()
//And the rest your code
        ** @magic This function gets called on creating an instance
function __construct()
//Now we can create a new instance from our class
$my = new MyClass;
$my->title = "This is the second example";
$my->content = "Just a little example";
$my->count = 10;

For more information send a message to info at phpclasses dot org.