JObject/get: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Returns a property of the object or the default value if the property is not set.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:J... |
m preparing for archive only |
||
| (One intermediate revision by the same user not shown) | |||
| Line 2: | Line 2: | ||
Returns a property of the object or the default value if the property is not set. | Returns a property of the object or the default value if the property is not set. | ||
===Syntax=== | ===Syntax=== | ||
| Line 45: | Line 43: | ||
</source> | </source> | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=get | category=get | ||
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
Returns a property of the object or the default value if the property is not set.
Syntax
get($property, $default=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $property | $property The name of the property. | |
| $default | null | $default The default value. |
Returns
mixed The value of the property.
Defined in
libraries/joomla/base/object.php
Importing
jimport( 'joomla.base.object' );
Source Body
public function get($property, $default=null)
{
if (isset($this->$property)) {
return $this->$property;
}
return $default;
}
Examples
Code Examples