3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $update_flag = 0; $row_avail = array( 'field_windows_value' => '2014-09-18T00:00:00', 'field_windows_value2' => '2015-09-30T00:00:00' ); if ( $row_avail['field_windows_value'] != $row_avail['field_windows_value2'] ) { if ( strtotime($row_avail['field_windows_value']) < time() && time() <= strtotime($row_avail['field_windows_value2']) ) { $update_flag = 1; } } else { if ( strtotime($row_avail['field_windows_value']) < time() && $row_avail['field_windows_value'] != NULL ) { $update_flag = 1; } } print $update_flag."\n"; $update_flag = 0; $last_start = 0; if ( $row_avail['field_windows_value'] != $row_avail['field_windows_value2'] ) { if ( strtotime($row_avail['field_windows_value2']) < time() ) { if ( $last_start != 0 && $last_start > time() ) { $update_flag = 1; break; } elseif ( $last_start == 0 ) { $update_flag = 1; break; } } } else { if ( strtotime($row_avail['field_windows_value2']) > time() && $row_avail['field_windows_value'] != NULL ) { $update_flag = 1; break; } } $last_start = $row_avail['field_windows_value']; print $update_flag."\n"; print $last_start."\n"; //$last_start = 0; $avail_result = array ( array ( 'field_availability_block_start_date' => '2014-09-18 00:00:00', 'field_availability_block_end_date' => '2015-09-30 00:00:00', ), array ( 'field_availability_block_start_date' => '2015-09-30 00:00:00', 'field_availability_block_end_date' => '2015-09-30 00:00:00', ), ); $loop_itr = 0 foreach ( $avail_result AS $row_avail ) { $loop_itr++; print "loop_itr = ".$loop_itr."\n"; if ( $row_avail['field_availability_block_start_date'] != $row_avail['field_availability_block_end_date'] ) { print "start != end\n"; if ( strtotime($row_avail['field_availability_block_end_date']) < time() ) { print "end < time\n"; if ( $last_start != 0 && $last_start > time() ) { $update_flag = 1; break; } elseif ( $last_start == 0 ) { $update_flag = 1; break; } } } else { if ( strtotime($row_avail['field_availability_block_end_date']) > time() && $row_avail['field_availability_block_start_date'] != NULL ) { $update_flag = 1; break; } } $last_start = $row_avail['field_availability_block_start_date']; } print strtotime($row_avail['field_availability_block_end_date'])."\n"; print $update_flag."\n"; print $last_start."\n";
based on rbHd6
Output for 5.4.0 - 5.4.32
Parse error: syntax error, unexpected 'foreach' (T_FOREACH) in /in/OBjXm on line 60
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_FOREACH in /in/OBjXm on line 60
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FOREACH in /in/OBjXm on line 60
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/OBjXm on line 60
Process exited with code 255.