3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sks = 11.5; $kurang = array(0,14); $cukup = array(0,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; } // 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; }
Output for 4.3.0 - 7.1.0
Array ( [0] => 0 [1] => 14 ) Array ( [1] => 14 [2] => 19.5 )