There are a few PHP functions (such as strstr, strpos and strrchr) that accept
a parameter named $haystack
. Where does this name come from?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With