Re: When is "z" != "z" ?
| From: | Rasmus Lerdorf | Date: | Tue, 06 Jun 2006 14:10:33 +0000 |
| Subject: | Re: When is "z" != "z" ? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237458@lists.php.net to get a copy of this message | ||
Martin Alterisio wrote:
You're right about ++ operator not to be considered a math operator, my mistake. What I should have said is that the usual connotation and expected behaviour of ++ and the comparison operators is to give iteration capabilities to a certain data type, as used in a for statement. For that to happen certain constrains must be true for these operators, one of them being: any < ++any, which is not true for the way these operators behave in php. I'm not saying "It's wrong let's change it right away!", I completely agree that these rules can be bent on a not strongly typed language. The point I'm trying to make, the thing I want to understant without a trace of doubt, is: is it really worthy the functionality supplied with the string ++ operator as it is? I don't see its usefullness yet.It has been in PHP from the very beginning. So 10+ years. In that time it has been sparingly used, granted, but at the same time it really hasn't gotten in the way and removing it would break a number of legacy applications. There were a lot more operators that worked on strings in the early days. '*' would do a cross-product, for example, treating the two string operands as vectors and returning a vector orthogonal to both of these. But I got tired of trying to explain to people what a cross product was and how strings mapped to vectors in Euclidean space and removed that. You could also at one point do "abc"-"b" to get "ac". -Rasmus