|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-06-27 17:55 UTC] gearond at sbcglobal dot net
Description: ------------ I originally submitted the material below this paragraph, but it has been discussed before - WITH the exception of the "" return value. There needs to be some description of circumstances under which "" gets returned. Otherwise it's a random response, and we programmers like finite responses :-) The function prototype on the document page says it returns an INT. The pink warning box at the bottom says it might return INT, BOOL, "". The return type should be set to MIXED. And in what case, given the decscription of this function's operation, would it return an empty string? Test script: --------------- Not needed Expected result: ---------------- n/a Actual result: -------------- n/a PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 17:00:02 2025 UTC |
It will never return empty string. It can however return int(0) and bool(false) which is what the note is about. Never do if(strpos($haystack, $needle)) {} to check if the $needle is in the $haystack. This is clearly demonstrated by the examples on the page.