So this is the string of nids given by my contextual filter: 20697,20735,20768,20903,20695,21863,20743,20726,20710,20730,20719,20691,20693,20701,20713,20699,20724,20751,20758,20859,20860,20861,20857,20858
Can you output a list of the nids contained in $view->result just before calling usort. Reason is that if it is not in the list it will return FALSE from array_search, and if two of then are bieng compared FALSE === FLASE