ID: 42903 Updated by: [EMAIL PROTECTED] Reported By: tiramon at gmx dot net -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: UNIX/WIN PHP Version: 5.2.4 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Use the third parameter to enable strict typing when you compare strings and integers. if ( in_array( "1a", array(1), true ) ) { echo "ok"; } In this case "1a" is converted to an integer and the result will be "1" Previous Comments: ------------------------------------------------------------------------ [2007-10-09 15:02:08] tiramon at gmx dot net Description: ------------ if ( in_array( "1a", array(1) ) ) { echo "ok"; } returns ok I know that it returns true if i compare "1" with 1 (string with int) and that there is a third parameter to avoid this. Bot imho "1a" and 1 are completly different and should even without type compare return false I tried this on a unix system with 5.2.0 and just to check if it was fixed in the current version with 5.2.4 at a win system Reproduce code: --------------- just execute if ( in_array( "1a", array(1) ) ) { echo "ok"; } Expected result: ---------------- No Output Actual result: -------------- script echoed "ok" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42903&edit=1
