Witam, mam taki kod:
<?php
//PHP as a template language
/*$topic = 'PHP as a template language';
$helloWorld = 'Hello World';*/
class Statement{
private $topic = 'PHP as a template language';
private $helloWorld = 'Hello World';
public function getTopic($topic){
return $this->topic = $topic;
}
public function getHelloWorld($helloWorld){
return $this->helloWorld = $helloWorld;
}
}
$obj = new Statement();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title><?=$obj->getTopic()?></title>
</head>
<body>
<?=$obj->getHelloWorld()?>
</body>
</html>
Uczę się programowania obiektowego i nie wszystko jeszcze pewnie rozumiem. Jak się pozbyć pojawiającego się ostrzeżenia i notatki? Mógłby ktoś może poprawić? Będę wdzięczny.
Warning: Missing argument 1 for Statement::getHelloWorld(), called in C:\xampp\htdocs\template\index.php on line 26 and defined in C:\xampp\htdocs\template\index.php on line 12
Notice: Undefined variable: helloWorld in C:\xampp\htdocs\template\index.php on line 13