Martin Alterisio wrote:
Still:
anything < ++anything
should be true, or at least that's what they taught me on abstract data
types design, and I think they're right (at least this time)
In loosely typed languages that is not always true. Operators have to
guess at the type and try to do what the user expects. There will
always be edge cases. Being able to increment strings is pretty handy
when you need to create sequences for unique file and directory names.
For example, this also works:
$filename = "file1";
$filename++;
echo $filename;
You would get "file2" from this. Think about the amount of code you
would need to write in C to make that work?
Then change $filename to "fileA" and increment it. And you get "fileB".
When we get to "fileZ" we don't want to go off into unprintable
character land, we want to try to stick with the pattern.
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php