You are here: Home » Blog » PHP » Sort multidimensional array by value.foreach (argsOfFunction as n > field). if (isstring(field)). I have a multidimensional array that holds information on images gotten from AWS S3, however when I get them, they are sorted purely like you would alphabetically.why dont you get the last int explode (.) then explode(-) add all the ints in a array then sort it after that you add the rest of the string ps The following code snippet will help to sort multi-dimensional arrays by a value of one of the elements.PHP7 Array Iteration Trick. Increment Numeric Part Of String. Return Class Constant From Variable. Why dont you get the last int explode (.) then explode(-) add all the ints in a array then sort it after that you add the rest of the string Ps : you can loop on the var name exemple : name explode(".",".35-aname-10.jpg") . Php Arrays Sorting Multidimensional-array. Related posts.