-like operator uses wildcards, and will perform a full-length comparison:
"a" -like "a" # true "ab" -like "a" # false
So if you want to test if one value contains another value, you have to put asterisks at the start and end of the wildcard string:
if ($key1 -like "*$key2*")
CLICK HERE to find out more related problems solutions.