3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $_GET['modeldate'] = '2016012200z'; // I chose key 8 $dates = array ( 0 => '2016012400z', 1 => '2016012318z', 2 => '2016012312z', 3 => '2016012306z', 4 => '2016012300z', 5 => '2016012218z', 6 => '2016012212z', 7 => '2016012206z', 8 => '2016012200z', 9 => '2016012118z', 10 => '2016012112z', 11 => '2016012106z', 12 => '2016012100z', 13 => '2016012018z', 14 => '2016012012z', 15 => '2016012006z', 16 => '2016012000z', 17 => '2016011918z', 18 => '2016011912z', 19 => '2016011906z', 20 => '2016011900z', 21 => '2016011818z', 22 => '2016011812z', 23 => '2016011806z', 24 => '2016011800z', 25 => '2016011718z', 26 => '2016011712z', 27 => '2016011706z', 28 => '2016011700z', 29 => '2016011618z', 30 => '2016011612z', 31 => '2016011606z', 32 => '2016011600z', 33 => '2016011518z', 34 => '2016011512z', 35 => '2016011506z', 36 => '2016011500z', 37 => '2016011418z', 38 => '2016011412z', 39 => '2016011406z', 40 => '2016011400z', 41 => '2016011318z', 42 => '2016011312z', 43 => '2016011306z', 44 => '2016011300z', 45 => '2016011218z', 46 => '2016011212z', 47 => '2016011206z', 48 => '2016011200z', 49 => '2016011118z', 50 => '2016011112z', 51 => '2016011106z', 52 => '2016011100z', 53 => '2016011018z', 54 => '2016011012z', 55 => '2016011006z', ); $prevdate = $nextdate = $currentdate = $dates[0]; $modeldate = false; if (!empty($_GET['modeldate'])) { $modeldate=$_GET['modeldate']; } if ($modeldate) { foreach($dates as $k => $date) { $nextdate = $currentdate; if ($modeldate === $date) { $currentdate = $date; $prevdate = $dates[$k+1]; break; } } } var_dump(($nextdate === $dates[7])??$nextdate, $currentdate === $dates[8], $prevdate === $dates[9]);
based on RB86q
Output for 7.0.0 - 7.2.0
bool(false) bool(true) bool(true)
Output for 5.3.22 - 5.6.28
Parse error: syntax error, unexpected '?' in /in/jmqHH on line 78
Process exited with code 255.