detlevski
-
Posts
2 -
Joined
-
Last visited
-
Days Won
1
Posts posted by detlevski
-
-
Change the sorting algorithm based on the desired sort order:if ($this->_order == 'ascending') { uasort($list, array($this,➝ 'ascSort')); } else {uasort($list, array($this, ➝ 'descSort'));}The second argument to the uasort() function should be the name of the function to use for the comparison.Because that function—ascSort() or descSort()—is defined as a methodin this current object, you can use this construct to reference it: array($this, 'methodName').In chapter 7 I don't get the construct above here in BOLD, did I miss something ?Why not use uasort($list, 'ascSort');
- 1
Chapter 7: Construct To Reference: Array($This, 'methodname')
in PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
Posted
Hi Larry, thanks for your reply, that makes sense and playin g with the file made it already clear.
By the way, the book is great for grasping the basics of OOP.