3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sks = 13; $kurang = array(0,8.5,14); $cukup = array(8.5,14,19.5); $lebih = array(14,19.5,24); $kc = array_intersect($kurang, $cukup); $cl = array_intersect($cukup, $lebih); print_r($kc); print_r($cl); // cl if ( $sks >= $cl[1] && $sks <= $cl[2] ) { $ftCukup = ($sks >= $cl[2]) ? "0" : ($sks <= $cl[2] ? ($sks - $kc[1]) / ($kc[2] - $kc[1]) : "0.5" ); $ftLebih = ($sks - $cl[1]) / ($cl[2] - $cl[1]); echo " ftLebih " .$ftLebih; echo " ftCukup " .$ftCukup; if ($ftLebih > $ftCukup) { echo "</br> . Beban Berlebih"; } else { echo "</br> . Beban Cukup"; } } // kc elseif ( $sks >= $kc[1] && $sks < $kc[2] ) { $ftKurang = ($kc[2] - $sks) / ($kc[2] - $kc[1]); $ftCukup = ($sks - $kc[1]) / ($kc[2] - $kc[1]); echo "ftKurang " .$ftKurang; echo "ftCukup " .$ftCukup; if ($ftKurang > $ftCukup) { echo "</br> . Beban Kurang"; } else { echo "</br> . Beban Cukup"; } } else { echo "Total SKS yang Diinputkan tidak bisa diproses Sistem "; }
Output for 4.3.0 - 7.1.0
Array ( [1] => 8.5 [2] => 14 ) Array ( [1] => 14 [2] => 19.5 ) ftKurang 0.18181818181818ftCukup 0.81818181818182</br> . Beban Cukup