Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Identity-matrix/PHP/identity-matrix.php
Normal file
8
Task/Identity-matrix/PHP/identity-matrix.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
function identity($length) {
|
||||
return array_map(function($key, $value) {$value[$key] = 1; return $value;}, range(0, $length-1),
|
||||
array_fill(0, $length, array_fill(0,$length, 0)));
|
||||
}
|
||||
function print_identity($identity) {
|
||||
echo implode(PHP_EOL, array_map(function ($value) {return implode(' ', $value);}, $identity));
|
||||
}
|
||||
print_identity(identity(10));
|
||||
Loading…
Add table
Add a link
Reference in a new issue