Last active
August 3, 2018 00:46
-
-
Save hasinhayder/2b41357892f3cd23e5d319ebe1c07bc8 to your computer and use it in GitHub Desktop.
create mxn matrix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$i1 = 2; //m | |
$i2 = 3; //n | |
//your requirement was that you will add 1 to the incoming data, here $i1 and $i2 - so added 1 with $i1 and $i2 in the loop below | |
$matrix = array(); | |
for($j=1;$j<=($i1+1);$j++){ | |
$_row = array_fill(0, ($i2+1), 0); | |
array_push($matrix,$_row); | |
} | |
print_r($matrix); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment