PHP code example of reeyanto / saw

1. Go to this page and download the library: Download reeyanto/saw library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

reeyanto / saw example snippets



Reeyanto\SAW\SAW;

$saw = new SAW();
$saw->addCriteria('Harga', 0.2, 'cost');
$saw->addCriteria('Kualitas', 0.5, 'benefit');
$saw->addCriteria('Fitur', 0.3, 'benefit');

$saw->addAlternative('Produk A', ['Harga' => 100, 'Kualitas' => 80, 'Fitur' => 70]);
$saw->addAlternative('Produk B', ['Harga' => 150, 'Kualitas' => 90, 'Fitur' => 80]);
$saw->addAlternative('Produk C', ['Harga' => 120, 'Kualitas' => 85, 'Fitur' => 75]);

$result = $saw->calculate();
print_r($result);