3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $hasil = 18; $kecewa = array(0,11,11.999); $biasa = array(11,11.999,16.111); $puas = array(11.999,16.111,20); $kb = array_intersect($kecewa, $biasa); $bp = array_intersect($biasa, $puas); print_r($kb); print_r($bp); if ( $hasil >= $bp [1]) { $muBiasa = ($hasil >= $bp[2]) ? "0" : ($hasil <= $bp[2] ? ($hasil - $kb[1]) / ($kb[2] - $kb[1]) : "0.5" ); $muPuas = ($hasil - $bp[1]) / ($bp[2] - $bp[1]); if ($muPuas > $muBiasa) { echo "Beban Berlebih"; } else { echo "Beban Cukup"; } } elseif ($hasil < $kb [2] ) { $muKecewa = ($kb[2] - $hasil) / ($kb[2] - $kb[1]); $muBiasa = ($hasil - $kb[1]) / ($kb[2] - $kb[1]); if ($muKecewa > $muBiasa) { echo "Beban Kurang"; } else { echo "Beban Cukup"; } }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [1] => 11 [2] => 11.999 ) Array ( [1] => 11.999 [2] => 16.111 ) Beban Berlebih