3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function percentToDegrees($percent) { $percent = intval($percent); if ($percent == 50) $degrees = 90; else if ($percent == 0) $degrees = 0; else if ($percent == 100) $degrees = 180; else if ($percent < 10) $degrees = 10; else if ($percent < 20) $degrees = 20; else if ($percent < 25) $degrees = 30; else if ($percent < 30) $degrees = 35; else if ($percent < 35) $degrees = 40; else if ($percent < 40) $degrees = 44; else if ($percent < 41) $degrees = 48; else if ($percent < 42) $degrees = 52; else if ($percent < 43) $degrees = 56; else if ($percent < 44) $degrees = 60; else if ($percent < 45) $degrees = 64; else if ($percent < 46) $degrees = 68; else if ($percent < 47) $degrees = 72; else if ($percent < 48) $degrees = 76; else if ($percent == 49) $degrees = 80; else if ($percent > 90) $degrees = 170; else if ($percent > 80) $degrees = 160; else if ($percent > 75) $degrees = 156; else if ($percent > 70) $degrees = 152; else if ($percent > 65) $degrees = 148; else if ($percent > 60) $degrees = 144; else if ($percent > 59) $degrees = 130; else if ($percent > 58) $degrees = 126; else if ($percent > 57) $degrees = 124; else if ($percent > 56) $degrees = 120; else if ($percent > 55) $degrees = 116; else if ($percent > 54) $degrees = 112; else if ($percent > 53) $degrees = 108; else if ($percent > 52) $degrees = 104; else if ($percent == 51) $degrees = 100; return $degrees; } foreach (range(0, 100) as $r) { echo "(" . $r . ", " . percentToDegrees($r) . "),"; }
Output for 5.0.4 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
(0, 0),(1, 10),(2, 10),(3, 10),(4, 10),(5, 10),(6, 10),(7, 10),(8, 10),(9, 10),(10, 20),(11, 20),(12, 20),(13, 20),(14, 20),(15, 20),(16, 20),(17, 20),(18, 20),(19, 20),(20, 30),(21, 30),(22, 30),(23, 30),(24, 30),(25, 35),(26, 35),(27, 35),(28, 35),(29, 35),(30, 40),(31, 40),(32, 40),(33, 40),(34, 40),(35, 44),(36, 44),(37, 44),(38, 44),(39, 44),(40, 48),(41, 52),(42, 56),(43, 60),(44, 64),(45, 68),(46, 72),(47, 76), Notice: Undefined variable: degrees in /in/VN40e on line 46 (48, ),(49, 80),(50, 90),(51, 100), Notice: Undefined variable: degrees in /in/VN40e on line 46 (52, ),(53, 104),(54, 108),(55, 112),(56, 116),(57, 120),(58, 124),(59, 126),(60, 130),(61, 144),(62, 144),(63, 144),(64, 144),(65, 144),(66, 148),(67, 148),(68, 148),(69, 148),(70, 148),(71, 152),(72, 152),(73, 152),(74, 152),(75, 152),(76, 156),(77, 156),(78, 156),(79, 156),(80, 156),(81, 160),(82, 160),(83, 160),(84, 160),(85, 160),(86, 160),(87, 160),(88, 160),(89, 160),(90, 160),(91, 170),(92, 170),(93, 170),(94, 170),(95, 170),(96, 170),(97, 170),(98, 170),(99, 170),(100, 180),
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 5.0.3
(0, 0),(1, 10),(2, 10),(3, 10),(4, 10),(5, 10),(6, 10),(7, 10),(8, 10),(9, 10),(10, 20),(11, 20),(12, 20),(13, 20),(14, 20),(15, 20),(16, 20),(17, 20),(18, 20),(19, 20),(20, 30),(21, 30),(22, 30),(23, 30),(24, 30),(25, 35),(26, 35),(27, 35),(28, 35),(29, 35),(30, 40),(31, 40),(32, 40),(33, 40),(34, 40),(35, 44),(36, 44),(37, 44),(38, 44),(39, 44),(40, 48),(41, 52),(42, 56),(43, 60),(44, 64),(45, 68),(46, 72),(47, 76), Notice: Undefined variable: degrees in /in/VN40e on line 46 (48, ),(49, 80),(50, 90),(51, 100), Notice: Undefined variable: degrees in /in/VN40e on line 46 (52, ),(53, 104),(54, 108),(55, 112),(56, 116),(57, 120),(58, 124),(59, 126),(60, 130),(61, 144),(62, 144),(63, 144),(64, 144),(65, 144),(66, 148),(67, 148),(68, 148),(69, 148),(70, 148),(71, 152),(72, 152),(73, 152),(74, 152),(75, 152),(76, 156),(77, 156),(78, 156),(79, 156),(80, 156),(81, 160),(82, 160),(83, 160),(84, 160),(85, 160),(86, 160),(87, 160),(88, 160),(89, 160),(90, 160),(91, 170),(92, 170),(93, 170),(94, 170),(95, 170),(96, 170),(97, 170),(98, 170),(99, 170),(100, 180),