#38299 [Opn->Bgs]: intval() does not convert floats when called from array_filter

From: Date: Wed, 02 Aug 2006 18:59:51 +0000
Subject: #38299 [Opn->Bgs]: intval() does not convert floats when called from array_filter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-100248@lists.php.net to get a copy of this message
ID: 38299 Updated by: tony2001@php.net Reported By: aeontech at gmail dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: mac os 10.4 PHP Version: 5.1.4 New Comment: http://php.net/array_filter Check out what array_filter() function _really_ does. Previous Comments: ------------------------------------------------------------------------ [2006-08-02 18:52:17] aeontech at gmail dot com Description: ------------ when I try to use array_filter to ensure that I have only integers in my array, I come across this error. Reproduce code: --------------- $arr = array('1','3.1',3.1,'a'); echo implode(',',array_filter($arr,'intval')); Expected result: ---------------- 1,3,3 Actual result: -------------- 1,3.1,3.1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38299&edit=1

« previous php.bugs (#100248) next »