Home » Tag Archives: usort() php version issue

Tag Archives: usort() php version issue

usort() function Issue with PHP 5.3

There is an issue existing with usort() function. Problem is purely related to php version, the old syntax is not work  well in php 5.3 Here is the fix for usort() function Issue with PHP 5.3 usort($aResult, function ($elem1, $elem2) { return strcmp($elem1[‘title’], $elem2[‘title’]); }); solution Use a different function. usort($aResult,”mySort“); function mySort($elem1,$elem2){ return strcmp($elem1[‘title’], $elem2[‘title’]); }

Read More »