3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $hasil = 52.5; $kecewa = array(0,40,60); $biasa = array(40,65,80); $puas = array(65,80,100); $kb = array_intersect($kecewa, $biasa); print_r($kb); if ( $hasil <= $kb ) { // hitung nilai kecewa pake rumus fuzzy logic $muKecewa = ($kb[2] - $hasil) / ($kb[2] - $kb[1]); //output : 52,5 $muBiasa = ($hasil - $kb[1]) / ($kb[2] - $kb[1]); echo $muKecewa; echo "<br />"; echo $muBiasa; } else { echo "false"; }
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Array ( [1] => 40 ) Notice: Undefined offset: 2 in /in/EfIA6 on line 12 Notice: Undefined offset: 2 in /in/EfIA6 on line 12 Notice: Undefined offset: 2 in /in/EfIA6 on line 13 1.3125<br />-0.3125
Output for hhvm-3.10.0 - 3.12.0
Array ( [1] => 40 ) Notice: Undefined index: 2 in /in/EfIA6 on line 12 Notice: Undefined index: 2 in /in/EfIA6 on line 12 Notice: Undefined index: 2 in /in/EfIA6 on line 13 1.3125<br />-0.3125
Output for 4.3.0 - 5.2.17
Array ( [1] => 40 ) Notice: Undefined offset: 2 in /in/EfIA6 on line 12 Notice: Undefined offset: 2 in /in/EfIA6 on line 12 Notice: Undefined offset: 2 in /in/EfIA6 on line 13 1.3125<br />-0.3125