JObject/set: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 4: | Line 4: | ||
===Syntax=== | ===Syntax=== | ||
| Line 43: | Line 43: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=set | category=set | ||
category=JObject | category=JObject | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
Latest revision as of 01:56, 25 March 2017
Description
Modifies a property of the object, creating it if it does not already exist.
Syntax
set($property, $value=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $property | $property The name of the property. | |
| $value | null | $value The value of the property to set. |
Returns
mixed Previous value of the property.
Defined in
libraries/joomla/base/object.php
Importing
jimport( 'joomla.base.object' );
Source Body
public function set($property, $value = null)
{
$previous = isset($this->$property) ? $this->$property : null;
$this->$property = $value;
return $previous;
}
Examples
Code Examples