3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $show = array( 'mon' => false, 'tue' => false, 'wed' => false, 'thu' => false, 'fri' => false, 'sat' => false, 'sun' => false ); $keys = array_keys($show); foreach (range(0,6) as $index) { $key = $keys[$index]; $show[$key] |= true; // in your case |= isset($post[$key]); } var_dump($show);
based on DjtaV
Output for 4.3.0 - 7.2.0
array(7) { ["mon"]=> int(1) ["tue"]=> int(1) ["wed"]=> int(1) ["thu"]=> int(1) ["fri"]=> int(1) ["sat"]=> int(1) ["sun"]=> int(1) }