JObject/get: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
Line 4: | Line 4: | ||
===Syntax=== | ===Syntax=== | ||
Line 44: | Line 44: | ||
===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