note 75897 added to language.oop5.visibility
| From: | chris at chrisstockton dot org | Date: | Wed, 20 Jun 2007 18:45:39 +0000 |
| Subject: | note 75897 added to language.oop5.visibility | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127838@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.39.81.135
Probable Submitter: 208.187.153.225
----
Manual Page -- http://www.php.net/manual/en/language.oop5.visibility.php
Edit -- https://master.php.net/note/edit/75897
Del: integrated -- https://master.php.net/note/delete/75897/integrated
Del: useless -- https://master.php.net/note/delete/75897/useless
Del: bad code -- https://master.php.net/note/delete/75897/bad+code
Del: spam -- https://master.php.net/note/delete/75897/spam
Del: non-english -- https://master.php.net/note/delete/75897/non-english
Del: in docs -- https://master.php.net/note/delete/75897/in+docs
Del: other reasons-- https://master.php.net/note/delete/75897
Reject -- https://master.php.net/note/reject/75897
Search -- https://master.php.net/manage/user-notes.php