|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1998-08-23 15:11 UTC] zeev
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
<?php ereg( "([0-9]{1,2})[^0-9]([0-9]{2,4})", "1/05", $regs ); if ( ($regs[2] <= 50) && ($regs[2] >= 0) ) $regs[2] += 2000; echo "Year: $regs[2]<br>"; ?> The script is meant to return: Year: 2005<br> However, it returns: Year: 2505<br> Bizzaaaarrrrrreeee! :) It only seems to happen if the array is assigned with ereg. A way to get around it is: $regs[2] = (int)$regs[2] + 2000; this then returns the correct result. This error occured on a just-compiled php from the command line with the following configure options: ./configure --with-mod_charset=no --with-gd=no --with-mysql --enable-magic-quotes=yes --disable-debug Finis!