[EMAIL PROTECTED] wrote: > I think this is a nice idea for php8 (or some release, IŽll never have > to use) > The main thing in using php is that it is close to c. > As there are so many new functions, some of them are not really > necessary, > I would not prefer shortcuts like these. Who should help these guys, > which > use these kind of abbrevations. We will get code like these "real > C-freaks" make > when they get mad in optimizing. > Its always a walk on a sharp edge, optimizimg and readability. > For "compatibility" reasons, I would not like this kind of stuff.
I don't agree with this. I find this kind of operator a specific necessity of PHP. In C you generally know when you have a variable assigned and when you don't. In PHP you have lots of situations where you have to test whether something has been set or not due to the nature of the environment (you don't know what happened in the previous page - in C you do know what a window does). That's because, as we all know too well, we operate PHP in a stateless environments - therefore you always have to check for stuff. > > and also, where can you write your comments > "old style" > if($whatever) // this option must be true > { > do something; // this operation does something > } // end of whatever > > "new style" > $whatever^=something // this option must be true an then it does > something > > (guaranteed to be more then 80 chars, have fun when reading this command > under production pressure at 0:30 at the box using ed) > oops I just wanted to add a comment, I find myself writing a book ;-) I merely proposed an assignment operator, not a new type of block. The funny thing is that you'd gain horizontal space instead of losing it: if (!$whatever) { $whatever=something; // defaulting to something } You just wasted a TAB for indentation - whatever the tab size is. Just to remind you, if you want to be formatting correct, the recommended TAB size is 8 chars. Whereas $whatever^=something; // defaulting to something wastes only one character (the caret). What I have to agree with is that it's not standard. That is correct - but I would find this operator useful and I'd be willing to sacrifice a bit of "standardness" in favor of writing less. Bogdan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php