Skip to content

Article __construct

perrym5 edited this page Apr 22, 2011 · 2 revisions

Description

This is the constructor for the Article class.

Prototype

Article Article->__construct( [variable list] )

Parameters

Option 1: Supply the constructor with a hash containing the keys: "headline", "summary", "date", and "url"

Option 2: Supply four seperate arguments which are: $headling, $summary, $date, $url

Return Value

Creates a new Article object

Examples

Code:

<?php
$data["headline"] = "Example Article";
$data["summary"] = "This is an example article!";
$data["date"] = date();
$data["url"] = "http://www.rpi.edu/";
$a = new Article( $data );
echo $a->headline;
?>

Outputs:

Example Article
Clone this wiki locally