3 ms·
Copy-pasting from an answer on reddit (https://www.reddit.com/r/PHP/comments/5eu9pc/whats_new_in_php_710/dafopvm/ https://www.reddit.com/r/PHP/comments/5eu9pc/w
by nikic 10y ago
Copy-pasting from an answer on reddit (https://www.reddit.com/r/PHP/comments/5eu9pc/whats_new_in_php_710/dafopvm/ https://www.reddit.com/r/PHP/comments/5eu9pc/whats_new_in_ph...):
Because the alternative conflicts in case we ever introduce generics. Consider <?php new Foo<Bar?> ?>. This could either be a generic instantiation, or it could be the same as <?php ((new Foo) < Bar) ?> ?> (which is how it is currently interpreted -- this is valid PHP code!)
Of course, you could specify how this is to be interpreted and implement the necessary parser hacks to make it happen, but it's best to avoid the issue altogether by using ? as a prefix.
I assume that this is also the reason why Hack does the same.