scanreg Posted October 9, 2008 Share Posted October 9, 2008 Am just starting to learn PHP ??? I have the following function: function dino($fred) { return $fred *= 2; } $wilma = 6; $barney = dino($wilma); echo "\$wilma is: $wilma<br />"; echo "\$barney is: $barney"; If you have $wilma = 6; why isn't it $wilma above in the function instead of $fred ? In other words, how does the script/php know to insert the value of $wilma into the function if it's $fred that is mentioned in the function, not $wilma ? Many thanks Quote Link to comment Share on other sites More sharing options...
Brandon Jaeger Posted October 9, 2008 Share Posted October 9, 2008 $fred is just a value of whatever is being sent through the function header. Quote Link to comment Share on other sites More sharing options...
scanreg Posted October 9, 2008 Author Share Posted October 9, 2008 I see, it's kind of a place holder (I think) Thanks Quote Link to comment Share on other sites More sharing options...
philipolson Posted October 9, 2008 Share Posted October 9, 2008 See also: http://php.net/functions Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 9, 2008 Share Posted October 9, 2008 The parameter name in the function definition is the variable name that the function will use to reference that parameter inside the function. When the function is called, the parameter can be supplied from anything - string, number, expression, variable, or another function call. Quote Link to comment Share on other sites More sharing options...
scanreg Posted October 9, 2008 Author Share Posted October 9, 2008 Super thanks, will eventually understand this stuff Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.