skrappy1979 Posted October 25, 2010 Share Posted October 25, 2010 Ok, starting around line 137 with the functions..... Commented well. Just not sure If im doing it right. Any help greatly appreciated. Basic stuff and still learning. Just trying to figure out if Im passing by reference correctly or if not how to do it. Thanks. php File is attached but heres a snippet. Thanks in advance. Peace, Adam // The grand total and the item total need to be passed BY REFERENCE. function show_table_contents($cart_items, $table, &$grand_total, &$item_total) [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
mentalist Posted October 25, 2010 Share Posted October 25, 2010 As far as i'm aware there are no pointers in PHP... Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted October 25, 2010 Share Posted October 25, 2010 Ok, starting around line 137 with the functions..... Commented well. Just not sure If im doing it right. Any help greatly appreciated. Basic stuff and still learning. Just trying to figure out if Im passing by reference correctly or if not how to do it. Thanks. php File is attached but heres a snippet. Thanks in advance. Peace, Adam // The grand total and the item total need to be passed BY REFERENCE. function show_table_contents($cart_items, $table, &$grand_total, &$item_total) Yes, that's how you do it. Quote Link to comment Share on other sites More sharing options...
mentalist Posted October 26, 2010 Share Posted October 26, 2010 Sorry for my ignorance, I did however ask the if you could here on this site a few years ago... http://php.net/manual/en/language.references.pass.php Quote Link to comment Share on other sites More sharing options...
skrappy1979 Posted October 26, 2010 Author Share Posted October 26, 2010 Thanks for the replys. I just wasnt sure. Sometimes it can look right but still be all wrong, lol. Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted October 26, 2010 Share Posted October 26, 2010 Thanks for the replys. I just wasnt sure. Sometimes it can look right but still be all wrong, lol. Glad to help. Just to clarify, you are actually passing values TO the function by reference so the function is actually modifying the variable that you passed. Returning a reference is different, you return a reference to something created in the function (must be persistent) like an object var or something. Quote Link to comment Share on other sites More sharing options...
skrappy1979 Posted October 26, 2010 Author Share Posted October 26, 2010 Awesome, Thx for the help. I'm learning as you can see but gettin somewhere anyway. Still learnin the lingo ya know. 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.