<?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";
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`