Jump to content


Photo

php shorthand


  • Please log in to reply
4 replies to this topic

#1 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 May 2006 - 08:38 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 03 May 2006 - 08:45 PM

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

#3 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 03 May 2006 - 08:49 PM

[!--quoteo(post=371061:date=May 3 2006, 03:45 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ May 3 2006, 03:45 PM) View Post[/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.

PHP Ninja

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 03 May 2006 - 08:53 PM

The long hand way of .= is the following:
$var1 = $var1 . $var2

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

#5 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 May 2006 - 08:55 PM

thanks

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users