note 113046 deleted from language.oop5.overloading by levim
| From: | levim@php.net | Date: | Mon, 16 Nov 2015 01:52:43 +0000 |
| Subject: | note 113046 deleted from language.oop5.overloading by levim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204154@lists.php.net to get a copy of this message | ||
Note Submitter: Yousef Ismaeil Cliprz[at]Gmail[Dot]com
----
Set a property outside object :
Yes we can
<?php
/**
* Example to Set and Get a property outside object
*
* @author Yousef Ismaeil Cliprz[At]Gmail[Dot]com
*/
class Apple {
/**
* Device name
*
* @var string
* @access public
*/
public $device;
}
// Create object
$apple = new Apple();
// Set device name
$apple->device = 'iPhone';
// set a new property
$apple->version = '4s'; // 4s for example
// Get the Apple::$device property and the new property Apple::$version
echo ("This is Apple {$apple->device} version {$apple->version}");
?>