3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum AgeRangeType { case UNSPECIFIED; // Not specified. case UNKNOWN; // Used for return value only. Represents value unknown in this version. case AGE_RANGE_18_24; // Between 18 and 24 years old. case AGE_RANGE_25_34; // Between 25 and 34 years old. case AGE_RANGE_35_44; // Between 35 and 44 years old. case AGE_RANGE_45_54; // Between 45 and 54 years old. case AGE_RANGE_55_64; // Between 55 and 64 years old. case AGE_RANGE_65_UP; // 65 years old and beyond. case AGE_RANGE_UNDETERMINED; // Undetermined age range. } define('AGE_RANGES', [ AgeRangeType::AGE_RANGE_18_24->name => ['min' => 18, 'max' => 24], AgeRangeType::AGE_RANGE_25_34->name => ['min' => 25, 'max' => 34], AgeRangeType::AGE_RANGE_35_44->name => ['min' => 35, 'max' => 44], AgeRangeType::AGE_RANGE_45_54->name => ['min' => 45, 'max' => 54], AgeRangeType::AGE_RANGE_55_64->name => ['min' => 55, 'max' => 64], AgeRangeType::AGE_RANGE_65_UP->name => ['min' => 65, 'max' => 135] ]); function qualifyingRanges(int $min_age, int $max_age): array { $result = []; foreach (AGE_RANGES as $rangeName => ['min' => $min, 'max' => $max]) { if ($max >= $min_age && $min <= $max_age) { $result[] = $rangeName; } elseif ($result) { break; } } return $result; } var_export(qualifyingRanges(20, 60));
Output for git.master_jit, git.master
array ( 0 => 'AGE_RANGE_18_24', 1 => 'AGE_RANGE_25_34', 2 => 'AGE_RANGE_35_44', 3 => 'AGE_RANGE_45_54', 4 => 'AGE_RANGE_55_64', )

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:
59.12 ms | 405 KiB | 5 Q