Marrvel Posted October 13, 2006 Share Posted October 13, 2006 Hello everybody, I'm working on a credit card validation but that's not important. While looking at some other peoples scripts for inspiration I found on with this syntax in the function declaration:[code] checkCreditCard ($cardnumber, $cardname, &$errornumber, &$errortext)[/code]all i want to know is why are there &'s in front of the last 2 variables? what does it do? I've never seen it used before.CheersRob Link to comment https://forums.phpfreaks.com/topic/23861-in-a-function-declaration/ Share on other sites More sharing options...
JayBachatero Posted October 13, 2006 Share Posted October 13, 2006 It's called pass by reference.http://us2.php.net/references Link to comment https://forums.phpfreaks.com/topic/23861-in-a-function-declaration/#findComment-108401 Share on other sites More sharing options...
fezzik Posted October 13, 2006 Share Posted October 13, 2006 The ampersand means that the value of the variable is being assigned by reference. I use the same CC function you posted. I also had the same question when I stumbled across the ampersand. Below is the link to my previous post which explains the "assign by reference" and how to use it with this function. In addition, I also posted the link to the php manual that explains variables.my previous post - http://www.phpfreaks.com/forums/index.php/topic,110130.0.htmlphp manual - http://us3.php.net/language.variablesBest,Fezzik Link to comment https://forums.phpfreaks.com/topic/23861-in-a-function-declaration/#findComment-108402 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.