3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Mutable $today = new DateTime; $yesterday = $today->sub(new DateInterval('P1D')); // subtract one day $tomorrow = $today->add(new DateInterval('P1D')); // add one day // $today, $yesterday and $tomorrow are all the same date! 🤯 echo "Today is ".$today->format('Y-m-d'). "\n"; echo "Yesterday is ".$yesterday->format('Y-m-d'). "\n"; echo "Tomorrow is ".$tomorrow->format('Y-m-d'). "\n"; // Immutable $today = new DateTimeImmutable; $yesterday = $today->sub(new DateInterval('P1D')); // subtract one day $tomorrow = $today->add(new DateInterval('P1D')); // add one day // $today, $yesterday and $tomorrow are all the same date! 🤯 echo "With DateTimeImmutable: Today is ".$today->format('Y-m-d'). "\n"; echo "With DateTimeImmutable: Yesterday is ".$yesterday->format('Y-m-d'). "\n"; echo "With DateTimeImmutable: Tomorrow is ".$tomorrow->format('Y-m-d'). "\n";
Output for git.master, git.master_jit, rfc.property-hooks
Today is 2020-12-03 Yesterday is 2020-12-03 Tomorrow is 2020-12-03 With DateTimeImmutable: Today is 2020-12-03 With DateTimeImmutable: Yesterday is 2020-12-02 With DateTimeImmutable: Tomorrow is 2020-12-04

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