Maybe I'm misunderstanding you, but if you're just comparing two numerical values, just remove the strlen.
So if $_GET['limit'] is set to 50, or some other integer, you can just change the code to:
<?php
if ($_GET['limit'] < 500) {
// limit is a smaller number than 500
$limit = $_GET['limit'];
} else {
die('Too many items');
}
?>
If you compare strlen, then the limit of, for example, 400 gets compared as a value of 3, which I assume you don't want.