Jump to content
Updating IPB tonight Read more... ×

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

php shorthand

Recommended Posts

Like css, is it better to stay away from php shorthand,
the
.= operator is to quickly add something to something, what is the long way, and which is better.

Share this post


Link to post
Share on other sites
The ".=" is not shorthand, but a defined way of using the operator. Just like "+=", "-=", "++", "--".

Use the language as it is defined and you will be fine.

Ken

Share this post


Link to post
Share on other sites
[!--quoteo(post=371061:date=May 3 2006, 03:45 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ May 3 2006, 03:45 PM) [snapback]371061[/snapback][/div][div class=\'quotemain\'][!--quotec--]
The ".=" is not shorthand, but a defined way of using the operator. Just like "+=", "-=", "++", "--".

Use the language as it is defined and you will be fine.

Ken
[/quote]

ken is correct. And in regards to shorthand, I would say it is better practice not to use it if you plan to write something that may run on diferent servers in the future, where you may not have access to the PHP configuration.

Share this post


Link to post
Share on other sites
The long hand way of [b].=[/b] is the following:
[code]$var1 = $var1 . $var2[/code]

The same with other ones such as += and -= etc

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.