Program for Identity Matrix | PHP program to print Identity Matrix ; Checking if row is equal to column ; Driver Code
< ? php function Identity ( $ num ) { $ row ; $ col ; for ( $ row = 0 ; $ row < $ num ; $ row ++ ) { for ( $ col = 0 ; $ col < $ num ; $ col ++ ) { if ( $ row == $ col ) echo 1 , " ▁ " ; else echo 0 , " ▁ " ; } echo " STRNEWLINE " ; } return 0 ; } $ size = 5 ; identity ( $ size ) ; ? >