Feature Request #3041

Add Arr:in() method, return value from array of allowed values

Added by Miodrag Tokić over 4 years ago. Updated over 4 years ago.

Status:ClosedStart date:07/01/2010
Priority:NormalDue date:
Assignee:Woody Gilk% Done:

0%

Category:Core
Target version:v3.0.7
Resolution:wontfix Points:

Description

Similar to Arr::get(), but return only if value is within range of values

    public static function in($array, $key, $values, $default = NULL)
    {
        return in_array(Arr::get($array, $key), $values) ? $value : $default;
    }

History

#1 Updated by Miodrag Tokić over 4 years ago

Ups...

    public static function in($array, $key, $values, $default = NULL)
    {
        $value = Arr::get($array, $key);

        return in_array($value, $values) ? $value : $default;
    }

#2 Updated by Ivan Kurnosov over 4 years ago

I think it is too specific to be a part of core.

#3 Updated by Miodrag Tokić over 4 years ago

Maybe you're right :)

#4 Updated by Woody Gilk over 4 years ago

  • Status changed from New to Closed
  • Resolution set to wontfix

Also available in: Atom PDF