Edit report at https://bugs.php.net/bug.php?id=64616&edit=1
ID: 64616 Updated by: ni...@php.net Reported by: spawnm at spawnm dot pl Summary: bug -Status: Open +Status: Not a bug Type: Bug Package: Arrays related Operating System: ubuntu 12.10 PHP Version: 5.4Git-2013-04-09 (Git) Block user comment: N Private report: N New Comment: By default in_array uses == comparison (and true == 'lol'). If you want to use strict === comparison pass "true" as an additional parameter: in_array('lol', $arr, true); Previous Comments: ------------------------------------------------------------------------ [2013-04-09 16:18:56] spawnm at spawnm dot pl Description: ------------ PHP Version: 5.4.6-1ubuntu1.2 $arr = array ( 'error' => true ); echo in_array('lol', $arr)? 1: 0;//1 $arr = array ( 'error' => 'true' ); echo in_array('lol', $arr)? 1: 0;//0 Test script: --------------- $arr = array ( 'error' => true ); echo in_array('lol', $arr)? 1: 0;//1 $arr = array ( 'error' => 'true' ); echo in_array('lol', $arr)? 1: 0;//0 Expected result: ---------------- $arr = array ( 'error' => true ); echo in_array('lol', $arr)? 1: 0;//1 $arr = array ( 'error' => 'true' ); echo in_array('lol', $arr)? 1: 0;//0 Actual result: -------------- $arr = array ( 'error' => true ); echo in_array('lol', $arr)? 1: 0;//1 $arr = array ( 'error' => 'true' ); echo in_array('lol', $arr)? 1: 0;//0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64616&edit=1