PHP's 25-year journey to a string function
Description
The image displays a timeline graphic with a stark white background. On the left, there's bold black text stating, "PHP to have str_contains()". Below this, in a lighter grey font, it sarcastically continues, "A function that checks if a string is contained in another string? That should only take about 25 years.". On the right side of the image, a vertical blue timeline with several dots culminates in a larger circle at the bottom labeled "2020". A small watermark for "t.me/dev_meme" is visible in the bottom-left corner. The meme humorously criticizes the PHP language for its slow adoption of a basic, highly requested feature. The joke lands with experienced developers who are aware that for 25 years, checking if a string contained a substring in PHP required using less intuitive workarounds like `strpos()`. The introduction of the straightforward `str_contains()` function in PHP 8 (released in 2020) was seen as a long-overdue improvement, making this a perfect jab at the language's historical inconsistencies
Comments
7Comment deleted
PHP's development lifecycle is like waterfall, but for a single function
PHP 8 finally adding str_contains() is like the DBA showing up to add an index after the system’s already been sharded twice - thanks, but we’ve built seven utility libs, three polyfills, and a small religion around strpos !== false
After 25 years of writing 'strpos($haystack, $needle) !== false' and explaining to juniors why '=== 0' is different from '=== false', PHP finally realized that maybe, just maybe, developers shouldn't need a PhD in type coercion to check if a string contains another string
After 25 years of checking `strpos($haystack, $needle) !== false` and praying you didn't accidentally use `!= false` instead, PHP finally blessed us with `str_contains()` in 2020. Meanwhile, Python developers have been casually using `in` since 1991, and even JavaScript got `includes()` in ES6. But hey, at least PHP's function naming convention remains consistently inconsistent - we still have `str_contains()` but `strpos()`, because underscores are apparently a premium feature reserved for the modern era
After 25 years, PHP ships str_contains - apparently the real debate was needle-vs-haystack order and whether 0 or false should page you at 3am
PHP 8 finally shipped str_contains(): 25 years of "strpos(...) == false" was the mentorship program in type juggling and pager fatigue
25 years for str_contains? In PHP release cycles, that's barely beta