#50132 [Bgs]: a bug(?) in the time() function

From: Date: Mon, 09 Nov 2009 23:15:39 +0000
Subject: #50132 [Bgs]: a bug(?) in the time() function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-144385@lists.php.net to get a copy of this message
ID: 50132 User updated by: saber_lowbob at live dot de Reported By: saber_lowbob at live dot de Status: Bogus Bug Type: Unknown/Other Function Operating System: Windows Vista SP1 PHP Version: 5.2.11 New Comment: nevermind, I found the error.. I think I've been up too long to do such a stupid mistake Previous Comments: ------------------------------------------------------------------------ [2009-11-09 23:06:26] saber_lowbob at live dot de the regex is right.. I'm sorting out all letters and checking if something's left in the string.. if not -> true ------------------------------------------------------------------------ [2009-11-09 22:51:17] rasmus@php.net Did you do any debugging at all to see why you might be getting that result? Hint, your regex string in the preg_replace() call is wrong. ------------------------------------------------------------------------ [2009-11-09 22:47:32] saber_lowbob at live dot de Description: ------------ a bug(?) in the time() function Reproduce code: --------------- function isInt($string) { $string = preg_replace('[0-9]','',$string); if($string == '') { return true; } else { return false; } } if(isInt(time())) { echo "is Int"; } else { echo "is not Int"; } Expected result: ---------------- is Int Actual result: -------------- is not Int ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50132&edit=1

« previous php.bugs (#144385) next »