API16

JObject/def: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Sets a default value if not alreay assigned <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]<...
 
m preparing for archive only
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
Sets a default value if not alreay assigned
Sets a default value if not alreay assigned


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JObject/def|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JObject/def}}
 
 


===Syntax===
===Syntax===
Line 40: Line 38:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JObject/def|Edit See Also]]<nowiki>]</nowiki>
 
</span>
{{SeeAlso:JObject/def}}


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=def
  category=def
  category=JObject
  category=JObject
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>

Latest revision as of 01:55, 25 March 2017

Description

Sets a default value if not alreay assigned



Syntax

def($property, $default=null)
Parameter Name Default Value Description
$property $property The name of the property.
$default null $default The default value.

Defined in

libraries/joomla/base/object.php

Importing

jimport( 'joomla.base.object' );

Source Body

public function def($property, $default=null)
{
        $value = $this->get($property, $default);
        return $this->set($property, $value);
}



Examples

Code Examples