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";

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
222 ms | 3392 KiB | 10 Q