3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tester { const EMERG = 0; // Emergency: system is unusable const ALERT = 1; // Alert: action must be taken immediately const CRIT = 2; // Critical: critical conditions const ERR = 3; // Error: error conditions const WARN = 4; // Warning: warning conditions const NOTICE = 5; // Notice: normal but significant condition const INFO = 6; // Informational: informational messages const DEBUG = 7; // Debug: debug messages private static $MESSAGE_PREFIXES = array ( Tester::EMERG => "\033[1;31m{EMERG}\033[0m ", Tester::ERR => "\033[1;31m{ERR}\033[0m ", Tester::CRIT => "\033[1;31m{CRIT}\033[0m ", Tester::WARN => "\033[1;33m{WARN}\033[0m ", Tester::DEBUG => "{DEBUG} ", Tester::INFO => "{INFO} ", Tester::NOTICE => "{NOTIC} ", Tester::ALERT => "{ALERT} " ); private static function addPrefix($message, $priority) { // ADDING COLOUR YAYYYY if(array_key_exists($priority, $MESSAGE_PREFIXES)){ // item is in the hastable $prefix = str_pad($MESSAGE_PREFIXES[$priority], 6, " "); $message = $prefix . $message; } return $message; } public static function myLog($message, $priority = Tester::DEBUG, $extras = null) { $message = Tester::addPrefix($message, $priority); echo $message . "\n"; } }; $path = "Blalala"; Tester::myLog("Saving file to third party at : $path", Tester::INFO); Tester::myLog(" "); Tester::myLog("GGSN plugin of monthly usage fraud found ", Tester::INFO); Tester::myLog("ggsnPlugin::handlerCollect collecting hourly data exceeders", Tester::DEBUG); Tester::myLog("Couldn't save file to third patry path at : $path", Tester::ERR); Tester::myLog("Couldn't find flat price for subscriber for billrun ", Tester::ALERT);

preferences:
60.13 ms | 402 KiB | 5 Q