ArrayUtil::get_value_or_default( array $array, string $key, null $default = null )

Gets the value for a given key from an array, or a default value if the key doesn’t exist in the array.


Description Description


Parameters Parameters

$array

(Required) The array to get the value from.

$key

(Required) The key to use to retrieve the value.

$default

(Optional) The default value to return if the key doesn't exist in the array.

Default value: null


Top ↑

Return Return

(mixed|null) The value for the key, or the default value passed.


Top ↑

Source Source

File: src/Utilities/ArrayUtil.php


			


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.