3v4l.org

run code in 300+ PHP versions simultaneously
<?php $year=2021; $month=7; $day=5; $index=-1; $period='day'; // strtotime test $dateString = $year . "-" . $month . "-" . $day . " -" . $index . " " . $period; $timestamp1 = strtotime("{$year}-{$month}-{$day} -{$index} {$period}"); // DateTime test $dateStamp = new \DateTime("{$year}-{$month}-{$day}"); $dateStamp->modify("-{$index} {$period}"); $timestamp2 = $dateStamp->getTimeStamp(); echo $dateString . PHP_EOL; echo "strtotime: " . $timestamp1 . PHP_EOL; echo "DateTime: " . $timestamp2;
Output for git.master, git.master_jit, rfc.property-hooks
2021-7-5 --1 day strtotime: 1625349600 DateTime: 1625349600

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