Using Class Visibility Operators : public « Class « PHP






Using Class Visibility Operators

 
<?php
class cd {
    public $artist;
    public $title;
    protected $tracks;
    private $disk_id;
}

$mydisk = new cd();

$mydisk->artist = 'Singers';

$mydisk->tracks = array('Bus', 'Little');
?>
  
  








Related examples in the same category

1.Use public properties directly
2.Public fields
3.public method
4.A Class with Public Properties