Can someone explain what's the difference between methodA
and methodB
(with "&" sign) in PHP?
<?php
class X{
public static function methodA(){return....;}
public static function &methodB(){return....;}
}
?>
Can someone explain what's the difference between methodA
and methodB
(with "&" sign) in PHP?
<?php
class X{
public static function methodA(){return....;}
public static function &methodB(){return....;}
}
?>
Adding an &
before the functions' name means it will return a reference instead of copying the return value back to the caller. You can find all the gritty details in the documentation.