RE: is <?= good?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Paul M Foster [mailto:paulf@xxxxxxxxxxxxxxxxx] 
> Sent: Saturday, June 12, 2010 10:40 PM
> 
> this in PHP. I can convert from '.' to '+' (as in most 
> languages) in my
> mind, but embedding variables in strings was a harder habit 
> to break. My
> opinion is that the dot operator used this way was a mistake for
> PHP. Not using the dot operator to mean "concatenate" would mean we
> could use it to replace the accursed '->' for class/method selection.
> And the plus operator is obviously a more natural fit for string
> concatenation.
> 
> And yes, if you're going to use the dot operator, surround it with
> spaces for readability.

Ironically, I believe that in the old days of PHP/FI the "+" was used
instead of "." -- to their defense, OOP wasn't even around then and so no
precedent had been set for the "." and I think they wanted to avoid
confusion with actual addition. I just remember having to go through and
re-work a bunch of code that broke b/c of this change.

But yes, I agree with you there. + should have stayed as the concat AND
addition, just like in JavaScript and other languages, and "." should have
been used instead of "->"

All of this I think could have been done AND maintain backwards
compatability with the use of some php.ini directives. Alternatively, I bet
some fancy regex scripts could also have been written that would migrate
"old" code to "new" code styles (I think the python guys did this for
"print")

*sigh*. It is what it is now. Ain't no going back from here. Like it or
lump it as they say.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux