Me and my coworker entered in a argument in which she said that we could'nt call any functions outside a method scope in a controller, and I think its possible.
Today my code is in the following way:
index.php:
<?php
require_once("baseController.php");
?>
<h1>
HERE I PROVE SOMETHING
</h1>
<?php
echo '<pre>', print_r(BaseController::aluno, 1), '<pre>';
?>
baseController.php
<?php
require_once('Aluno.php');
class BaseController{
public static $aluno = new Aluno();
}
Aluno.php
<?php
class Aluno{
public $nome;
public $idade;
}
I don't really know what am I doing wrong, am I not allowed to do this? Always when I try to run the code it generates a error 500 in the console. What is happening here?