Reputation: 638
I'am working with URLs and I'm try to checkif an url has the words I am looking for
I'm using this
$alreadySaved = 'storage.googleapis';
$contains = Str::contains($alreadySaved, $imageUrl);
if ($contains == false) {
but the result of $contains is false EVER
for example
that $imageUrl has storage.googleapis word
how can I solve it?
I need to obtain if the string has "storage.googleapis" and return true
Upvotes: 0
Views: 3281
Reputation: 106
It looks like all you need to do is switch $alreadySaved
and $imageUrl
. Laravel's Str::contains
method takes the string you're searching through first and the substring second.
Like this:
$contains = Str::contains($imageUrl, $alreadySaved);
Upvotes: 4