3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDaysLeft(DateTimeImmutable $now, DateTimeImmutable $until): void { $diff = $now->diff($until); var_dump( ($diff->invert ? -1 : 1) * ($diff->days + $diff->h / 24 + $diff->i / (24 * 60) + $diff->s / (24 * 60 * 60)) ); var_dump(((int) $diff->format("%r1")) * ($diff->format("%a") + $diff->format("%h") / 24 + $diff->format("%i") / (24 * 60) + $diff->format("%s") / (24 * 60 * 60))); } // subscription has expired half a day ago getDaysLeft(new DateTimeImmutable("2023-11-24 00:00:00"), new DateTimeImmutable("2023-11-23 12:00:00")); // subscription will expire in hald a day getDaysLeft(new DateTimeImmutable("2023-11-24 00:00:00"), new DateTimeImmutable("2023-11-24 12:00:00"));
Output for 8.1.25 - 8.1.33, 8.2.12 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
float(-0.5) float(-0.5) float(0.5) float(0.5)
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
93.26 ms | 407 KiB | 5 Q