Rank of an element in a stream | Driver code
< ? php $ a = array ( 5 , 1 , 14 , 4 , 15 , 9 , 7 , 20 , 11 ) ; $ key = 20 ; $ arraySize = sizeof ( $ a ) ; $ count = 0 ; for ( $ i = 0 ; $ i < $ arraySize ; $ i ++ ) { if ( $ a [ $ i ] <= $ key ) { $ count += 1 ; } } echo " Rank ▁ of ▁ " . $ key . " ▁ in ▁ stream ▁ is : ▁ " . ( $ count - 1 ) . " STRNEWLINE " ; ? >