From 2a9bedc61b6459ee5097651cbb7e06121130f054 Mon Sep 17 00:00:00 2001 From: foobar Date: Sun, 12 Nov 2000 03:57:21 +0000 Subject: [PATCH] fix pr: 7763 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@35604 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/strings.xml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/functions/strings.xml b/functions/strings.xml index 59245e37e0..6a0ed5b47a 100644 --- a/functions/strings.xml +++ b/functions/strings.xml @@ -2425,6 +2425,28 @@ echo str_repeat ("-=", 10); If needle is not found, returns false. + + + It is easy to mistake the return values for "character found at + position 0" and "character not found". Here's how to detect + the difference: + + +// in PHP 4.0b3 and newer: +$pos = strrpos ($mystring, "b"); +if ($pos === false) { // note: three equal signs + // not found... +} + +// in versions older than 4.0b3: +$pos = strrpos ($mystring, "b"); +if (is_string ($pos) && !$pos) { + // not found... +} + + + + If needle is not a string, it is converted