https://www.php-fig.org/psr/psr-2/
Although we've got a function declared in this code which throws a warning for PSR1 (a pre-req for PSR2).
Files SHOULD either declare symbols (classes, functions, constants, etc.) or cause side-effects (e.g. generate output, change .ini settings, etc.) but SHOULD NOT do both.
I've also amended spacing a little to prevent code like <?php $this.$that+123 ?>
so instead we have
I have removed the old array()
syntax and use []
instead as it's cleaner and identical
Finally I have some further recommendations:
- We should really avoid so much html and php in the same file. We should probably look at a larger task to split the main html templates out.
- In php tags I think it's good to use the full
<php
tag but in html files it's preferable to use short tags to save space and keep things clean.<?= $that['thing'] ?>
instead of