3v4l.org

run code in 300+ PHP versions simultaneously
<?php $today = new DateTime; $randomAfternoonTime = (clone $today)->setTime(13, 25); $randomNightTime = (clone $today)->add(new DateInterval('P1D'))->setTime(2, 23); // Times relevant to Amsterdam on 2020-09-23. $sunsetTime = (clone $today)->setTime(19, 36); $sunriseTime = (clone $today)->add(new DateInterval('P1D'))->setTime(7, 30); echo "Sunset at:\n" . $sunsetTime->format('Y-m-d H:i') . "\n\n"; echo "Sunrise at:\n" . $sunriseTime->format('Y-m-d H:i') . "\n\n"; echo "Some time in the afternoon (NOT in between sunset/sunrise):\n" . $randomAfternoonTime->format('Y-m-d H:i') . "\n\n"; echo "At night (in between sunset/sunrise):\n" . $randomNightTime->format('Y-m-d H:i') . "\n\n"; // Shows bool(false): 13:25 is not in between sunset/sunrise. var_dump($randomAfternoonTime->getTimestamp() > $sunsetTime->getTimestamp() && $randomAfternoonTime->getTimestamp() < $sunriseTime->getTimestamp()); // Shows bool(true): 02:23 is in between sunset/sunrise. var_dump($randomNightTime->getTimestamp() > $sunsetTime->getTimestamp() && $randomNightTime->getTimestamp() < $sunriseTime->getTimestamp());
Output for git.master, git.master_jit, rfc.property-hooks
Sunset at: 2024-05-02 19:36 Sunrise at: 2024-05-03 07:30 Some time in the afternoon (NOT in between sunset/sunrise): 2024-05-02 13:25 At night (in between sunset/sunrise): 2024-05-03 02:23 bool(false) bool(true)

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:
125.39 ms | 406 KiB | 5 Q