Ouzo\Utilities\Arrays::getValue PHP Метод

getValue() публичный статический Метод

Example: $array = array('id' => 1, 'name' => 'john'); $value = Arrays::getValue($array, 'name'); Result: john Example: $array = array('id' => 1, 'name' => 'john'); $value = Arrays::getValue($array, 'surname', '--not found--'); Result: --not found--
public static getValue ( array $elements, string | integer $key, mixed | null $default = null ) : mixed | null
$elements array
$key string | integer
$default mixed | null
Результат mixed | null
    public static function getValue(array $elements, $key, $default = null)
    {
        return isset($elements[$key]) ? $elements[$key] : $default;
    }

Usage Example

Пример #1
0
 public static function newInstance($options)
 {
     if (Arrays::getValue($options, Options::EMULATE_PREPARES)) {
         return new EmulatedPDOPreparedStatementExecutor();
     }
     return new PDOPreparedStatementExecutor();
 }
All Usage Examples Of Ouzo\Utilities\Arrays::getValue