开发者

The term "haystack" in the context of PHP

开发者 https://www.devze.com 2023-02-07 02:16 出处:网络
There are a few PHP functions (such as strstr, strpos and strrchr)that accept a parameter named $haystack. Where开发者_如何学Go does this name come from?

There are a few PHP functions (such as strstr, strpos and strrchr) that accept a parameter named $haystack. Where开发者_如何学Go does this name come from?

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):

The term "haystack" in the context of PHP


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号