PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Tom Schaefer   TypeSafeStruct   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: as the name says
Class: TypeSafeStruct
Manipulate type safe objects
Author: By
Last change: chg
Date: 15 years ago
Size: 712 bytes
 

Contents

Class file image Download
/**
 * @author Thomas Schaefer
 * @mail scaphare@gmail.com
*/

// classes
include "TypedStruct.class.php";
include "TypeSafeStruct.class.php";
include "SerializeTypedStruct.class.php";

// sample model
include "Model_Objects_Countries.php";

// instantiate
$clsObject = new Model_Objects_Countries;

// add some data
$clsObject->setContinent("Asia");
$clsObject->setCode("ALC");

switch($_GET["format"]){
    case "xml":
        header("content-type:text/xml");
        echo SerializeTypedStruct::toXML($clsObject);
        break;
    case "sqlInsert":
        echo SerializeTypedStruct::sqlInsert($clsObject,"Countries");
        break;
    default:
        print "<pre>";
        echo $clsObject;
        print "<pre>";
        break;
}