The term "haystack" in the context of PHP
It comes from the idiom "needle in a haystack". The needle is the item you're searching for (in this case the substring, or search string), the haystack is what the needle is located within (in this case the input string).
Edit (pst - to visualize answer):
Finding a needle in a haystack. You are looking for a substring in a bigger string.
A Needle in a haystack is a figure of speech used to refer to something that is difficult to locate in a much larger space. - wiki