Jump to content
Larry Ullman's Book Forums

detlevski

Members
  • Posts

    2
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by detlevski

  1. 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 method

    in 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');

    • Upvote 1
×
×
  • Create New...