|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-04-14 20:27 UTC] helly@php.net
[2006-04-16 21:50 UTC] bugzilla at yakasha dot net
[2006-04-17 17:02 UTC] mike@php.net
[2006-04-18 01:58 UTC] bugzilla at yakasha dot net
[2006-04-18 05:57 UTC] mike@php.net
[2006-04-18 06:45 UTC] bugzilla at yakasha dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 03:00:01 2025 UTC |
Description: ------------ Please universalize the argument ordering for search functions like strstr & in_array. It's annoying to have to constantly second guess myself, "Which uses needle/haystack and which is haystack/needle" Reproduce code: --------------- <?php $needle = "what"; $haystack = "Is what you're looking for in here?"; $stringFound = strstr($needle, $haystack); $haystack = explode(" ", $haystack); $arrayFound = in_array($needle, $haystack); echo "String: " . ($stringFound ? "found\n" : "not found\n"); echo "Array: " . ($arrayFound ? "found\n" : "not found\n"); ?> Expected result: ---------------- String: found Array: found Actual result: -------------- String: not found Array: found