note 75897 deleted from language.oop5.visibility by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 22:59:03 +0000 |
| Subject: | note 75897 deleted from language.oop5.visibility by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134557@lists.php.net to get a copy of this message | ||
Note Submitter: chris at chrisstockton dot org
----
One note that I have not found in the documentation but have found to be valid is a alternative
syntax for visibility assignment. Take into consideration a previous example of:
<?php
class Foo
{
const sudo = 'sudo';
const finger = 'finger';
const strings = 'strings;
private $a;
private $b;
private $c;
private $d;
private $e;
private $f;
protected $g;
protected $h;
protected $i;
protected $j;
public $k;
public $l;
public $m;
public function __construct() {}
}
?>
Can also be written, slightly more elegantly as:
<?php
class Foo
{
const
sudo = 'sudo',
finger = 'finger',
const strings = 'strings;
private
$a,
$b,
$c,
$d,
$e,
$f;
protected
$g,
$h,
$i,
$j;
public
$k,
$l,
$m;
public function __construct() {}
}
?>
Just make sure to end the assignment with your semicolon, and separate assignment with commas.