1--TEST-- 2Logical filter: boolean 3--SKIPIF-- 4<?php if (!extension_loaded("filter")) die("skip"); ?> 5--FILE-- 6<?php 7$booleans = array( 8'1' => true, 9'On' => true, 10'Off' => true, 11'True' => true, 12'TrUe' => true, 13'oN' => true, 14 15'0' => false, 16'Off' => false, 17'False' => false, 18'faLsE' => false, 19'oFf' => false, 20 21'' => false 22); 23 24foreach($booleans as $val=>$exp) { 25 $res =filter_var($val, FILTER_VALIDATE_BOOLEAN); 26 if ($res !== $exp) { 27 echo "$val failed,'$exp' expect, '$res' received.\n"; 28 } 29} 30echo "Ok."; 31?> 32--EXPECTF-- 33Ok. 34