Bug #74133 [Com]: PHP function in_array() return wrong.
| From: | long dot it dot stu at gmail dot com | Date: | Mon, 20 Feb 2017 09:09:32 +0000 |
| Subject: | Bug #74133 [Com]: PHP function in_array() return wrong. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207453@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74133&edit=1
ID: 74133
Comment by: long dot it dot stu at gmail dot com
Reported by: long dot it dot stu at gmail dot com
Summary: PHP function in_array() return wrong.
Status: Feedback
Type: Bug
Package: Arrays related
Operating System: Centos
PHP Version: 5.6.30
Block user comment: N
Private report: N
New Comment:
with function range(1, 1.9, 0.1) it return result under:
Array
(
[0] => 1
[1] => 1.1
[2] => 1.2
[3] => 1.3
[4] => 1.4
[5] => 1.5
[6] => 1.6
[7] => 1.7
[8] => 1.8
)
when i check in_array(1.7, range(1, 1.9, 0.1));
it return False;
But all item in array except 1.7 it return False.
in range(0, 0.9, 0.1) it resut too.
Previous Comments:
------------------------------------------------------------------------
[2017-02-20 08:20:13] requinix@php.net
None of those four values exist in either of those two arrays.
------------------------------------------------------------------------
[2017-02-20 06:29:15] long dot it dot stu at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/security.globals
---
PHP function in_array() return False although it existing.
Test script:
---------------
<?php
$array_1 = range(1, 1.9, 0.1);
var_dump(in_array(1.7, $array_1));
array_2 = range(0, 0.9, 0.1);
var_dump(in_array(0.3, $array_2));
var_dump(in_array(0.6, $array_2));
var_dump(in_array(0.7, $array_2));
//=>it return false;
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74133&edit=1