I have this code:
<?php
function f() {
return 5;
}
$a = 5;
And I am using NetBeans 8.2 with PSR-1 compatibility check turned on. And I am getting this error:
Why is that and how can I fix it?
I have this code:
<?php
function f() {
return 5;
}
$a = 5;
And I am using NetBeans 8.2 with PSR-1 compatibility check turned on. And I am getting this error:
Why is that and how can I fix it?
Copyright © 2021 Jogjafile Inc.
The PSR-1 standard states that
This means if you have function or class definitions in a file, you shouldn't have code with side-effects (like a variable assignment) outside these definitions within the same file.
So
and
should be separated into different files.