PHP 8.4.24 Released!

Voting

: max(six, six)?
(Example: nine)

The Note You're Voting On

jexy dot ru at gmail dot com
9 years ago
Docs are missing that WARNING is issued if needle is '' (empty string).

In case of empty haystack it just return false:

For example:

<?php
var_dump(strpos('foo', ''));

var_dump(strpos('', 'foo'));

var_dump(strpos('', ''));
?>

will output:

Warning: strpos(): Empty needle in /in/lADCh on line 3 
bool(false) 

bool(false) 

Warning: strpos(): Empty needle in /in/lADCh on line 7 
bool(false)

Note also that warning text may differ depending on php version, see https://3v4l.org/lADCh

<< Back to user notes page

To Top