|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-01-10 09:34 UTC] rasmus@php.net
[2010-01-10 22:37 UTC] jani@php.net
[2010-01-11 09:06 UTC] miklcct at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Mar 24 03:00:01 2026 UTC |
Description: ------------ The function stripos() returns FALSE when a empty string is used. Consider the example below, an empty string is used and it is found at position 0. It is misleading (at least theoretically) that an empty string is not found inside another string. Reproduce code: --------------- <?php var_dump(stripos('test', 'te')); var_dump(stripos('test', 't')); var_dump(stripos('test', '')); var_dump(stripos('test', 'es', 1)); var_dump(stripos('test', 'e', 1)); var_dump(stripos('test', '', 1)); var_dump(stripos('test', '', 2)); var_dump(stripos('', '')); ?> Expected result: ---------------- int(0) int(0) int(0) int(1) int(1) int(1) int(2) int(0) Actual result: -------------- int(0) int(0) bool(false) int(1) int(1) bool(false) bool(false) bool(false)