3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calculValeurEcoGes($valeur, $type = 1) { $intervalles = array( // Indice 1= Eco, Indice 2=GES 1 => array ('A' => array(0, 50), 'B' => array(51, 90), 'C' => array(91, 150), 'D' => array(151, 230), 'E' => array(231, 330), 'F' => array(331, 450), 'G' => array(451, 99999)), 2 => array('A' => array(0, 5), 'B' => array(6, 10), 'C' => array(11, 20), 'D' => array(21, 35), 'E' => array(36, 55), 'F' => array(56, 80), 'G' => array(81, 99999)) ); if($type < 1 || $type > 2) { exit("Erreur, le type de valeur éco. doit être compris entre 1 et 2"); } $intervalle = $intervalles[$type]; foreach($intervalle as $lettre => $minMax) { list($min, $max) = $minMax; if($valeur >= $min && $valeur <= $max) { return $lettre; } } return 'Z'; } echo calculValeurEcoGes(40, 1);
Output for git.master, git.master_jit, rfc.property-hooks
A

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.07 ms | 401 KiB | 8 Q