Hello everyone,

I'd like to propose an RFC to deprecate and eventually remove the "var"
keyword.

My understanding is that this keyword was kept in PHP 5 for
backwards-compatibility with PHP 4.  However, it's been 9 years since PHP 4
was discontinued, so I'd like to bring this topic up for review.

Usage of "var" doesn't seem to be as widespread recently. I've done a quick
search of several major projects and libraries and found that only a couple
are using it.  I personally haven't seen it used in any PHP 5.3+ project
I've worked on in recent memory.

Because "var" simply acts as an alias for "public", removing it should not
cause any loss of functionality.  Yes, it's a BC break, but developers can
easily replace it with "public" to maintain the same functionality.

PHP 7 deprecated PHP 4 style constructors in favor of the PHP 5
__construct() method.  I'd like to propose doing the same for the "var"
keyword - deprecate it in PHP 7.1 and remove it in a future version (7.2 or
8.0?)

I'd appreciate any thoughts or feedback you may have, especially if you
have any objections to me creating an RFC for this proposal.

Best regards,

Colin O'Dell

Reply via email to