I want to sort an array that looks like this (to numerical order instead of 1, 10, 11):
Array ( [0] => 1.jpg [1] => 10.jpg [2] => 11.jpg [3] => 1
You should read the manual on sort(), you give it a reference for an array, and it'll work on it. No need to reassign it.
sort($array);
and not
$array = sort($array);