Function to generate the required matrix
< ? php function solve ( $ n ) { $ initial_array = array ( array ( ) ) ; $ final_array = array ( array ( ) ) ; for ( $ i = 0 ; $ i < $ n - 1 ; ++ $ i ) $ initial_array [ 0 ] [ $ i ] = $ i + 1 ;