<?php
$angka1 = [[1, 2, 3], [2, 3, 4]]; // 2x3
$angka2 = [[5, 6, 5], [3, 7, 8], [7, 5, 6]]; // 3x3
$hasil = [];
// Initialize the result matrix
for ($i = 0; $i < 2; $i++) {
for ($j = 0; $j < 3; $j++) {
$hasil[$i][$j] = 0; // Initialize each element of the result
for ($k = 0; $k < 3; $k++) { // Loop for columns of angka1
$hasil[$i][$j] += $angka1[$i][$k] * $angka2[$k][$j];
}
}
}
// Display the result
foreach ($hasil as $baris) {
echo "[" . implode(",", $baris) . "]" . "\n"; }
PD9waHAKCiRhbmdrYTEgPSBbWzEsIDIsIDNdLCBbMiwgMywgNF1dOyAvLyAyeDMKJGFuZ2thMiA9IFtbNSwgNiwgNV0sIFszLCA3LCA4XSwgWzcsIDUsIDZdXTsgLy8gM3gzCiRoYXNpbCA9IFtdOwoKLy8gSW5pdGlhbGl6ZSB0aGUgcmVzdWx0IG1hdHJpeApmb3IgKCRpID0gMDsgJGkgPCAyOyAkaSsrKSB7CiAgICBmb3IgKCRqID0gMDsgJGogPCAzOyAkaisrKSB7CiAgICAgICAgJGhhc2lsWyRpXVskal0gPSAwOyAvLyBJbml0aWFsaXplIGVhY2ggZWxlbWVudCBvZiB0aGUgcmVzdWx0CiAgICAgICAgZm9yICgkayA9IDA7ICRrIDwgMzsgJGsrKykgeyAvLyBMb29wIGZvciBjb2x1bW5zIG9mIGFuZ2thMQogICAgICAgICAgICAkaGFzaWxbJGldWyRqXSArPSAkYW5na2ExWyRpXVska10gKiAkYW5na2EyWyRrXVskal07CiAgICAgICAgfQogICAgfQp9CgovLyBEaXNwbGF5IHRoZSByZXN1bHQKZm9yZWFjaCAoJGhhc2lsIGFzICRiYXJpcykgewogICAgZWNobyAiWyIgLiBpbXBsb2RlKCIsIiwgJGJhcmlzKSAuICJdIiAuICJcbiI7Cn0=