note 128032 added to language.basic-syntax.comments

From: Date: Wed, 21 Dec 2022 00:51:01 +0000
Subject: note 128032 added to language.basic-syntax.comments
Groups: php.notes 
Request: Send a blank email to php-notes+get-219989@lists.php.net to get a copy of this message
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. ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.175 (proxied: 2.36.178.66) ---- Manual Page -- https://php.net/manual/en/language.basic-syntax.comments.php Edit -- https://main.php.net/note/edit/128032 Del: integrated -- https://main.php.net/note/delete/128032/integrated Del: useless -- https://main.php.net/note/delete/128032/useless Del: bad code -- https://main.php.net/note/delete/128032/bad+code Del: spam -- https://main.php.net/note/delete/128032/spam Del: non-english -- https://main.php.net/note/delete/128032/non-english Del: in docs -- https://main.php.net/note/delete/128032/in+docs Del: other reasons-- https://main.php.net/note/delete/128032 Reject -- https://main.php.net/note/reject/128032 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219989) next »