Location: PHPKode > scripts > TypeSafeStruct > typesafestruct/sample.php
/**
 * @author Thomas Schaefer
 * @mail hide@address.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;
}
Return current item: TypeSafeStruct