3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'ID' => 16, 'begin_date' => new \DateTime('2016-01-01 UTC'), 'end_date' => new \DateTime('2016-11-30 UTC'), ], [ 'ID' => 33, 'begin_date' => new \DateTime('2016-01-04 UTC'), 'end_date' => new \DateTime('2016-02-29 UTC'), ], ]; var_dump($data[0]['begin_date']['date']); function choose ($begin, $end) { $choice = null; if($begin > now()) { // condition one, cannot be leading, choose the other. $choice = $end; } if($start > now()) { //$choice } }

preferences:
76.06 ms | 402 KiB | 5 Q