Kamis, 03 Oktober 2013

PHP Indonesia - Facebook: [help]gan, ane ada permasalahan dikit dalam perkal...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
Manage your social media

Best social media tool for image publishing to Facebook and Twitter. Look amazing and delight your followers. Get 40% off when you sign up today.
From our sponsors
[help]gan, ane ada permasalahan dikit dalam perkal...
Oct 4th 2013, 04:01, by Rere Saputra

Rere Saputra 4:01am Oct 4
[help]gan, ane ada permasalahan dikit dalam perkalian matrik
mohon pencerahan dunk gan :3
gini, gan ane ada array $data 1D dan $data2 2D
$data = array(4.36435, 3.61812, 2.5584);
$data2 = array(
array( 2.1822, 4.36435, 1.0911),
array(1.20604, 1.20604, 3.61812),
array(1.7056, 2.5584, 2.5584)
);

gimana cara memanggil indeks array dan value sehingga prosesnya sprti dibawah:

SQRT(POW(2.1822 - 4.36435)+POW( 4.36435-3.61812)+POW( 1.0911-2.5584))
SQRT(POW(1.20604 - 4.36435)+POW(1.20604-3.61812)+POW(3.61812-2.5584))
SQRT(POW(1.7056 - 4.36435)+POW( 2.5584-3.61812)+POW(2.5584-2.5584))

ane coba gini gan tapi masih salah cara pemanggilan valuenya :3
$hasil = array();
for ($i=0; $i<count($data2); $i++){
for ($j=0; $j<count($data2[$i]); $j++){
if(isset($data[$i])){
$hasil[0][$j] += SQRT(POW($data2[$i][$j]-$data[$i],2));
}
}
}
echo "<pre>";
print_r($hasil);
echo "</pre>";

untuk outputnya array 1D berisikan 3 valu array
mohon bantuan gan :3

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar