In this post, we will see about difference between contains() & containsStrict() Methods
contains() Method #
if we Look contains() method Syntax:
/**
* Determine if an item exists in the enumerable.
*
* @param mixed $key
* @param mixed $operator
* @param mixed $value
* @return bool
*/
public function contains($key, $operator = null, $value = null);
contains() if an element exists in the collection matching a given truth other wise it return false .let see example
$collection = collect([
'apple',
'samsung',
'xiaomi',
'oppo'
]);
$collection->contains('apple'); //true
$collection->contains('htc'); //false
we can see apple is exists then it will return true and htc not exists then it will return false
Problem with contains() method #
Read also #
Laravel php artisan inspire command
Laravel clear cache without using artisan command