Print an N x M matrix such that each row and column has all the vowels in it | Function to print the required matrix ; Impossible to generate the required matrix ; Store all the vowels ; Print the matrix ; Print vowels for every index ; Shift the vowels by one ; Driver code
< ? php function printMatrix ( $ n , $ m ) { if ( $ n < 5 $ m < 5 ) { echo - 1 ; return ; } $ s = " aeiou " ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { for ( $ j = 0 ; $ j < $ m ; $ j ++ ) { echo $ s [ $ j % 5 ] . " " ; } echo " STRNEWLINE " ; $ c = $ s [ 0 ] ; for ( $ k = 0 ; $ k < 4 ; $ k ++ ) { $ s [ $ k ] = $ s [ $ k + 1 ] ; } $ s [ 4 ] = $ c ; } } $ n = 5 ; $ m = 5 ; printMatrix ( $ n , $ m ) ; return 0 ; ? >