3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ConvertData { public static function facilityName2Value() { return array( 'LOG_AUTH' => LOG_AUTH, 'LOG_AUTHPRIV' => LOG_AUTHPRIV, 'LOG_CRON' => LOG_CRON, 'LOG_DAEMON' => LOG_DAEMON, 'LOG_KERN' => LOG_KERN, ) + (!defined('PHP_WINDOWS_VERSION_BUILD') ? array( 'LOG_LOCAL0' => LOG_LOCAL0, 'LOG_LOCAL1' => LOG_LOCAL1, 'LOG_LOCAL2' => LOG_LOCAL2, 'LOG_LOCAL3' => LOG_LOCAL3, 'LOG_LOCAL4' => LOG_LOCAL4, 'LOG_LOCAL5' => LOG_LOCAL5, 'LOG_LOCAL6' => LOG_LOCAL6, 'LOG_LOCAL7' => LOG_LOCAL7, ) : array( 'LOG_LOCAL0' => 128, // LOG_LOCAL0 'LOG_LOCAL1' => 136, // LOG_LOCAL1 'LOG_LOCAL2' => 144, // LOG_LOCAL2 'LOG_LOCAL3' => 152, // LOG_LOCAL3 'LOG_LOCAL4' => 160, // LOG_LOCAL4 'LOG_LOCAL5' => 168, // LOG_LOCAL5 'LOG_LOCAL6' => 176, // LOG_LOCAL6 'LOG_LOCAL7' => 184, // LOG_LOCAL7 ) ) + array( 'LOG_LPR' => LOG_LPR, 'LOG_MAIL' => LOG_MAIL, 'LOG_NEWS' => LOG_NEWS, 'LOG_SYSLOG' => LOG_SYSLOG, 'LOG_USER' => LOG_USER, 'LOG_UUCP' => LOG_UUCP, ); } } // simplified for testing purposes function getLogFacilitiesOptions() { $str = ''; foreach (ConvertData::facilityName2Value() as $name => $facility) { $str .= sprintf( '<option value="%s">%s</option>'."\n", $facility, $name ); } return $str; } echo getLogFacilitiesOptions();
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.27, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
<option value="32">LOG_AUTH</option> <option value="80">LOG_AUTHPRIV</option> <option value="72">LOG_CRON</option> <option value="24">LOG_DAEMON</option> <option value="0">LOG_KERN</option> <option value="128">LOG_LOCAL0</option> <option value="136">LOG_LOCAL1</option> <option value="144">LOG_LOCAL2</option> <option value="152">LOG_LOCAL3</option> <option value="160">LOG_LOCAL4</option> <option value="168">LOG_LOCAL5</option> <option value="176">LOG_LOCAL6</option> <option value="184">LOG_LOCAL7</option> <option value="48">LOG_LPR</option> <option value="16">LOG_MAIL</option> <option value="56">LOG_NEWS</option> <option value="40">LOG_SYSLOG</option> <option value="8">LOG_USER</option> <option value="64">LOG_UUCP</option>
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/MKvY1 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/MKvY1 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/MKvY1 on line 3
Process exited with code 255.