3v4l.org

run code in 300+ PHP versions simultaneously
<?php function outputOptions(array $options){ if ($options[0] == 'email') { echo "You can send the selected records to your email."; } else { echo "You can download the selected records in $options[0]"; $last = count($options) - 1; if($last == 0) echo '.'; else { for($i = 1; $i < $last; $i++) echo ", $options[$i]"; echo $options[$last] == 'email' ? ', or send them to your email.' : ", or $options[$last]."; } } echo "\n"; } outputOptions(['Word']); outputOptions(['Word', 'Excel']); outputOptions(['Word', 'PDF']); outputOptions(['Word', 'Excel', 'PDF']); outputOptions(['email']); outputOptions(['Word', 'email']); outputOptions(['Word', 'Excel', 'email']); outputOptions(['Word', 'PDF', 'email']); outputOptions(['Word', 'Excel', 'PDF', 'email']);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
You can download the selected records in Word. You can download the selected records in Word, or Excel. You can download the selected records in Word, or PDF. You can download the selected records in Word, Excel, or PDF. You can send the selected records to your email. You can download the selected records in Word, or send them to your email. You can download the selected records in Word, Excel, or send them to your email. You can download the selected records in Word, PDF, or send them to your email. You can download the selected records in Word, Excel, PDF, or send them to your email.

preferences:
84.46 ms | 1188 KiB | 4 Q