helpers\BaseArrayHelper isIn()

isIn() public static method (available since version 2.0.7)

Check whether an array or Traversable contains an element.

This method does the same as the PHP function in_array() but additionally works for objects that implement the Traversable interface.

See also http://php.net/manual/en/function.in-array.php.

public static boolean isIn ( $needle, $haystack, $strict = false )
$needle mixed

The value to look for.

$haystack array|Traversable

The set of values to search.

$strict boolean

Whether to enable strict (===) comparison.

return boolean

true if $needle was found in $haystack, false otherwise.

throws yii\base\InvalidParamException

if $haystack is neither traversable nor an array.

doc_Yii
2016-10-30 17:04:27
Comments
Leave a Comment

Please login to continue.