Inserts a key in arr [ ] of given capacity . n is current size of arr [ ] . This function returns n + 1 if insertion is successful , else n .
< ? php function insertSorted ( & $ arr , $ n , $ key , $ capacity ) {