Jump to content
Larry Ullman's Book Forums

larryb

Members
  • Posts

    2
  • Joined

  • Last visited

larryb's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I'm an engineer by education and a programmer by hobby. I bought this book to help me learn OOP with php and it has proven to be an extremely valuable resource. One topic that is introduced early in the book is sorting multidimensional arrays. I've always handled multidimensional arrays a little differently than what is introduced in the book so I wonder if I'm doing something wrong or something too 'old school'. Using the example on page 5, I would create arrays like this: $ar[0][0] = 256; $ar[1][0] = "Jon"; $ar[2][0] = 98.5; $ar[0][1] = 2; $ar[1][1] = "Vance"; $ar[2][1] = 85.1; $ar[0][2] = 9; $ar[1][2] = "Stephen"; $ar[2][2] = 94.0; To sort, I use the array_multisort php statement. So my question, aside from some extra typing, what's the difference between using the above approach versus the method in the book ? array(StudentID => array('name' => 'Name', grade = xx.x)) Aren't they both multidimensional arrays ?
×
×
  • Create New...