3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function calculate($input) { $count = 0; foreach ($input as $value) if (!empty($value)) $count++; return $count < 3 ? $count * 8.5 : 20; } $_SESSION = array(); // simuleren van een SESSION array $_SESSION['input']['1'] = 'JA'; $_SESSION['input']['2'] = ''; $_SESSION['input']['3'] = 'JA'; $_SESSION['input']['4'] = ''; $_SESSION['input']['5'] = ''; $_SESSION['input']['6'] = ''; echo 'Het bedrag is: &euro,- ' . calculate($_SESSION['input']); ?>
Output for 4.3.0 - 7.1.0
Het bedrag is: &euro,- 17