Beginner question about arrays
Posted: Mon Apr 09, 2012 4:03 pm
I have a very basic question. I inherited some PHP/Javascript/HTML code and new tools so I'm trying to learn everything simultaneously. Here's a snippet that's confusing me...
I'm trying to remove the icon so I commented out the last line of the code as follows:
This is triggering an exception and I don't understand why. I believe the code is taking the student's first name and description and putting it into the 'student.firstName' array. Then it's repeating the process for the 'student.lastName' array and the 'icon' array and then putting all three arrays into the 'attributes' array. If this is correct, why would simply removing the 'icon' array from the 'attributes' array trigger an exception.
Thanks in advance. B
Code: Select all
$enrollment->setSort(array('attributes' => array('*',
'student.firstName' => array('asc' => 'student.firstName', 'desc' => 'student.firstName desc'),
'student.lastName' => array('asc' => 'student.lastName', 'desc' => 'student.lastName desc'),
'icon' => array('asc' => 'iconFile', 'desc' => 'iconFile desc'),
)));
Code: Select all
$enrollment->setSort(array('attributes' => array('*',
'student.firstName' => array('asc' => 'student.firstName', 'desc' => 'student.firstName desc'),
'student.lastName' => array('asc' => 'student.lastName', 'desc' => 'student.lastName desc'),
// 'icon' => array('asc' => 'iconFile', 'desc' => 'iconFile desc'),
)));
Thanks in advance. B