3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $matrix = array ( array (1,2, 3), array (4, 5, 6), array (7, 8, 9), ); $sum1 = $matrix[0][0] * $matrix[1][1] * $matrix [2][2]; $sum2 = $matrix[0][1] * $matrix[1][2] * $matrix [2][0]; $sum3 = $matrix[0][2] * $matrix[1][0] * $matrix [2][1]; $sum4 = $matrix[2][0] * $matrix[1][1] * $matrix [0][2]; $sum5 = $matrix[2][1] * $matrix[1][2] * $matrix [0][0]; $sum6 = $matrix[2][2] * $matrix[1][0] * $matrix [0][1]; $result= $sum1 + $sum2 + $sum3 - $sum4 - $sum5 - $sum6; $zeile=0; $spalte=0; for ($zeile=0; $zeile<=2; $zeile++) { for( $spalte=0; $spalte<=2; $spalte++ ) { echo "m[".$zeile.", ".$spalte."]=".$matrix[$zeile][$spalte]; } } ?>
based on Tkf4u
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
m[0, 0]=1m[0, 1]=2m[0, 2]=3m[1, 0]=4m[1, 1]=5m[1, 2]=6m[2, 0]=7m[2, 1]=8m[2, 2]=9