note 119714 deleted from language.oop5.constants by cmb
| From: | cmb@php.net | Date: | Tue, 09 Aug 2016 11:25:15 +0000 |
| Subject: | note 119714 deleted from language.oop5.constants by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-206246@lists.php.net to get a copy of this message | ||
Note Submitter: nsrahou at gmail dot com
----
As of PHP 7.1 class constants may now be defined with different visibilities from the default public
scope. That means, the keywords public, protected and private are now possibles. Just like this :
<?php
class Foo
{
// Public constant, but not declared explicitly
const PUBLIC_CONST_A = 1;
// Public declared constant
public const PUBLIC_CONST_B = 2;
// Protected declared constant
protected const PROTECTED_CONST = 3;
// Private declared constant
private const PRIVATE_CONST = 4;
}