php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38299 intval() does not convert floats when called from array_filter
Submitted: 2006-08-02 18:52 UTC Modified: 2006-08-02 18:59 UTC
From: aeontech at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.4 OS: mac os 10.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: aeontech at gmail dot com
New email:
PHP Version: OS:

 

 [2006-08-02 18:52 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-02 18:59 UTC] tony2001@php.net
http://php.net/array_filter
Check out what array_filter() function _really_ does.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 20 21:00:02 2025 UTC