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 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 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 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
Archived
This topic is now archived and is closed to further replies.