nimzie Posted August 20, 2008 Share Posted August 20, 2008 function relatedcontent_get_nodes(&$node) { $nodes = $node->nodes; // Keeps $node immutable. asort($nodes, SORT_NUMERIC); return array_keys($nodes); } How do I call it and how must I initialize &$node? Thanks for your assistance. Adam Quote Link to comment https://forums.phpfreaks.com/topic/120613-question-on-calling-a-function-should-be-a-simple-one/ Share on other sites More sharing options...
nimzie Posted August 21, 2008 Author Share Posted August 21, 2008 I know this is almost a ridiculous question, but I can't figure out the &$ bit and how to init/call/use this function in my code. Pretty please help! Adam Quote Link to comment https://forums.phpfreaks.com/topic/120613-question-on-calling-a-function-should-be-a-simple-one/#findComment-621557 Share on other sites More sharing options...
JonnoTheDev Posted August 21, 2008 Share Posted August 21, 2008 The & is passing the variable by reference so its value is changed outside the scope of the function i.e function add(&$x) { $x = $x+1; } $x = 1; add($x); print $x; // should print 2 Quote Link to comment https://forums.phpfreaks.com/topic/120613-question-on-calling-a-function-should-be-a-simple-one/#findComment-621929 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.