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
  • 178,314
  • 47
  • 389
  • 754
learner
  • 2,219
  • 3
  • 18
  • 22
  • 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,561
  • 3
  • 30
  • 41