CakeFest 2025 Madrid: The Official CakePHP Conference

Voting

: max(zero, nine)?
(Example: nine)

The Note You're Voting On

aetonsi
2 years ago
As of php 8, single line comments starting exactly with "#[" have a special meaning: they are treated as "attributes", and they must respect the expected syntax. See: https://www.php.net/manual/en/language.attributes.php

So the following code throws an error in php 8+, while it is perfectly valid in php <8:
<?php
#[~~my super cool comment~~~]
?>

To be safe, just always use "//" comments instead of "#". Maybe in the future there will be other special meanings for the "#" comments, who knows.

<< Back to user notes page

To Top