3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dateTime = new DateTime('2016-10-16'); $data['endDate'] = (clone $dateTime->modify(('Sunday' == $dateTime->format('l')) ? 'Saturday next week' : 'Saturday this week'))->format('Y-m-d 23:59:59'); var_dump($dateTime);
based on VkcRl
Output for 7.0.20, 7.1.5 - 7.3.0beta1
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-10-22 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.8 - 7.0.13, 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-10-17 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.0 - 7.0.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-10-29 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.0 - 5.6.28
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/MHe4l on line 5
Process exited with code 255.