I use the Views PHP field to retrieve a numeric value from database, but it could not be sorted even after i have checked the Enable click sort and select Sort numerically.

It will throws an error.
It can be fixed by selecting Sort using custom PHP code with the following code.
return $row1->php - $row2->php;
Done =)
Reference: Views PHP sort snippet does not work

Nice post! Looks simple but I couldn’t get it to work
What problem did u meet?
Hi,
I’ve a view which displays users posts related to specific nodes (suppose comments to nodes), when showing comments I want to show comments of author first and then sort other comments in ascending order. To achieve this I’ve added a PHP field which return integer i.e. if current comment author is same as node author then -1, else comment author.
I’ve followed the instruction in your post but its not working.
Have you added any filters to sort with?
Have you added “value code” in your Global: PHP field
Hi,
Thanks, got it working, here is Drupal.org issue link for solution I’ve refered to:
http://drupal.org/node/1178170#comment-6032566
Good to know that you have found the solution. =)