0

hi I am a php developer.

Recently I got an old project using php5 which I have to upgrade to PHP5.3.

In old version of php5 coding they declare functions in two different ways

public function &getMyname(){

}

Some other place they are defining like normal

public function getMyname(){

}

What is the difference between these two declarations.

hakre
  • 193,403
  • 52
  • 435
  • 836
learner
  • 2,609
  • 4
  • 22
  • 23
  • Is this question answers yours? http://stackoverflow.com/questions/3957584/how-does-operator-work-in-php-function – bertzzie Aug 03 '11 at 11:12

1 Answers1

1

The first method will return by reference.

http://www.php.net/manual/en/language.references.return.php

Peter Porfy
  • 8,921
  • 3
  • 31
  • 41