Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: max(three, two)?
(Example: nine)

The Note You're Voting On

jexy dot ru at gmail dot com
8 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