3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sks = 11.5; $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); // antara 65 - 80 if ( $sks >= $cl[1] && $sks <= $cl[2] ) { $muBiasa = ($sks >= $cl[2]) ? "0" : ($sks <= $cl[2] ? ($sks - $kc[1]) / ($kc[2] - $kc[1]) : "0.5" ); $muPuas = ($sks - $cl[1]) / ($cl[2] - $cl[1]); echo " muPuas " .$muPuas; echo " muBiasa " .$muBiasa; } // antara 40 - 65 elseif ( $sks >= $kc[1] && $sks < $kc[2] ) { $muKecewa = ($kc[2] - $sks) / ($kc[2] - $kc[1]); $muBiasa = ($sks - $kc[1]) / ($kc[2] - $kc[1]); echo "muKecewa " .$muKecewa; echo "muBias " .$muBiasa; }
Output for 4.3.0 - 7.1.0
Array ( [1] => 8.5 [2] => 14 ) Array ( [1] => 14 [2] => 19.5 ) muKecewa 0.45454545454545muBias 0.54545454545455