Determinan&Matris

mail@pastecode.io avatar
unknown
php
2 years ago
521 B
9
Indexable
Never
<?php
    $matris1 = [
        [1,  2],
        [3,  4]
    ];

    $Result = [] ;

    $Determinan = ( $matris1 [0][0] * $matris1 [1][1] ) - ( $matris1 [0][1] * $matris1 [1][0] ) ;
    
    for($i=0 ; $i < count($matris1); $i++ ){
        for( $j = 0 ; $j < count($matris1[$i]) ; $j++){
            $Result [$i][$j] = $Determinan * $matris1[$i][$j] ;
        }
    }

    echo " Determinan is : " ;
    echo $Determinan ;
    echo PHP_EOL ;
    
    print_r($Result);
    echo PHP_EOL ;
    ?>