开发者

The term "haystack" in the context of PHP

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜