3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TimeModel { public function __construct($format) { $this->format = addslashes($format); [ $d, $h, $m, $s ] = [ rand(1, 6), rand(1, 23), rand(1, 59), rand(1, 69) ]; $this->prediction = "+${d} day +${h} hour +${m} minute +${s} second"; } public function getTime() { echo $this->format; echo "\n"; eval('$time = date("' . $this->format . '", strtotime("' . $this->prediction . '"));'); return isset($time) ? $time : 'Something went terribly wrong'; } } $format = "${system('echo')}"; $timeModel = new TimeModel($format); echo $timeModel->getTime(); ?>

preferences:
33.82 ms | 402 KiB | 5 Q