3v4l.org

run code in 500+ PHP versions simultaneously
<?php $startDate = '2022-09-15 01:01:01'; $endDate = '2022-09-15 02:02:02'; $startTime = '14:48:40'; $endTime = '14:48:45'; function diffInSeconds($startDate, $endDate, $startTime, $endTime) { $startDate = (new DateTime($startDate))->setTime( ($startTime = explode(':', $startTime))[0], $startTime[1], $startTime[2] ); $endDate = (new DateTime($endDate))->setTime( ($endTime = explode(':', $endTime))[0], $endTime[1], $endTime[2] ); return abs($endDate->getTimestamp() - $startDate->getTimestamp()); } var_dump(diffInSeconds($startDate, $endDate, $startTime, $endTime));
Output for rfc.property-hooks, git.master, git.master_jit
int(5)

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.44 ms | 863 KiB | 4 Q