Example #1
0
<?php

class Article
{
    public $title;
    public $text;
    public function __construct($title, $text)
    {
        $this->title = $title;
        $this->text = $text;
    }
    public function viev()
    {
        echo $this->title;
        echo '<br>';
        echo $this->text;
    }
}
$a = new Article("Заголовк", "Текст новости");
$a->viev();