|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-08-25 23:27 UTC] sniper@php.net
[2003-08-26 17:43 UTC] elite_eagle67 at hotmail dot com
[2003-08-27 05:41 UTC] derick@php.net
[2003-08-27 17:18 UTC] elite_eagle67 at hotmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 20:00:02 2025 UTC |
Description: ------------ Do (int)$var where $var is an array that has some kind of value stored, and the return value will be 1, not 0. Now this obviously doesn't make sense as you cast to (int) so you can see if a variable has a valid INTEGER variable, NOT if it is the integer equivilent of a * boolean * value. Ofcourse, an empty array in this example will return 0, as would be expected behavior for a BOOLEAN cast, not integer howerever... I'm unaware how (string) cast deals with this, possibly similiar but if so, then just apply this bug report to that ;) Reproduce code: --------------- $array = array( 'yay' => 'boo!' ); if((int)$array) { echo (int)$array; } else { echo (int)$array; } Expected result: ---------------- 0 Actual result: -------------- 1