Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $criterions=array(
- '1'=>'K1-JP',
- '2'=>'K2-KP',
- '3'=>'K3-JA',
- '4'=>'K4-L'
- );
- $relations=array(
- array('1','2',3),
- array('1','3',4),
- array('1','4',2),
- array('2','3',4),
- array('2','4',3),
- array('3','4',5)
- );
- $rel=array();
- foreach($relations as $r){
- $rel[$r[0]][$r[1]]=$r[2];
- }
- ?>
- <table border='1'>
- <tr>
- <th>Kode</th>
- <?php
- foreach($criterions as $head){
- echo "<th>{$head}</th>";
- }
- ?>
- </tr>
- <?php
- foreach($criterions as $kr=>$row_head){
- echo "<tr><th>{$row_head}</th>";
- foreach($criterions as $kc=>$col){
- $val=round($kr<$kc?$rel[$kr][$kc]:($kr==$kc?1:1/$rel[$kc][$kr]),3);
- echo "<td>{$val}</td>";
- }
- echo "</tr>";
- }
- ?>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement