I am having array in which different letter in each word is capital like:
aPple, Orange, baNana, mANgo, Papaya
I want to get the position of the first letter that is capital. And order them accordingly.
That is the word that has first letter capital will be first, and then with second letter capital will be second etc… Like
Orange
Papaya
aAple
mAngo
baNana
If two words come with capital letter in same position for example in above list
Orange and Pappaya comes with first letter as capital, then they have to be sorted in alphabetic order.
Is this very hard to achieve in php?
You could use
strcspn()For example:
Full Code
Output
You use that function to do your (reverse) sort.