lp__object_property_value( $property, $object, $default = null, $static = false )

This function allows you to retrieve the value of a property from an object. If the property exists in the object, the corresponding value is returned; otherwise, the default value is returned.

Plugin

Namespace

Launchpad

Parameters

string

$property

The object property.

object

$object

The object.

mixed

$default

Default value to return if the property does not exist (default: null).

mixed

$static

Object property static access type (default: false).

Return

mixed

The value of the property, or the default value if the property does not exist.

Source

File: \includes\lp-utility-functions.php

function lp__object_property_value( $property, $object, $default = null, $static = false ) {
    if($static) $value = isset($object::${$property} ) ? $object::${$property} : $default;
    else $value = isset($object->{$property}) ? $object->{$property} : $default;
    return $value;
}

Related

Used to insert a value or an array into an array before or after a specified identifier.

Used to retrieve the value from an array based on a given key.

Used to checks if an array is associative.

Used to retrieve the value from an array based on a given key.