Function to check if all elements present in descending diagonal starting from position ( i , j ) in the matrix are all same or not
< ? php function checkDiagonal ( $ mat , $ i , $ j ) { $ N = 5 ; $ M = 4 ; $ res = $ mat [ $ i ] [ $ j ] ; while ( ++ $ i < $ N && ++ $ j < $ M ) {