3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_start = explode(" ", microtime()); $_sys['load'][] = ($_start[1] + $_start[0]) - $_sys['load'][0]; unset($_start); function format_string($value) { $value = trim( preg_replace("/[^\p{L}\p{N}!?@#$%_^{}.,|&*+\-():\[\]\/\\\]/u", " ", html_entity_decode($value, ENT_QUOTES, "UTF-8"))); if (!empty($value)) { return $value; } else { return false; } } function format_string_import($value) { $value = str_replace("-_", "-", str_replace("_-", "-", str_replace("_-_", "-", preg_replace('/_+/', '_', preg_replace('/-+/', '-', strtolower( trim( preg_replace("/[^\p{L}\p{N}-\'\"_]/u", "_", html_entity_decode($value, ENT_QUOTES, "UTF-8") ) ) ) ) ) ) )); while (isset($value[0]) && $value[0] == "_") { $value = substr($value, 1); } while (isset($value[0]) && $value[0] == "-") { $value = substr($value, 0, -1); } while (isset($value[0]) && substr($value, -1) == "-") { $value = substr($value, 0, -1); } while (isset($value[0]) && substr($value, -1) == "_") { $value = substr($value, 0, -1); } if (isset($value[0])) { return $value; } else { return false; } } function format_num($value) { $value = (int)preg_replace("/[^0-9]/", null, $value); if (isset($value[0])) { return $value; } else { return false; } } function mmc_query($q, $server = 0) { if (!empty($q)) { if ($GLOBALS['_config']['sql_cache'] == 1) { if ($d = mmc_read($q, $server)) { return unserialize(base64_decode($d)); } else { if ($d = read_mysql($q, $server)) { mmc_send($q, base64_encode(serialize($d)), $server); return $d; } else { return false; } } } else { return read_mysql($q, $server); } } else { return false; } } function mmc_read($o, $server = 0) { if (!empty($o)) { if (!isset($GLOBALS['MEMCACHE'][$server])) { $GLOBALS['MEMCACHE'][$server] = memcache_connect($GLOBALS['_config']['memcached_host'][$server], 0); } if ($r = memcache_get($GLOBALS['MEMCACHE'][$server], md5($o . $_SERVER['SERVER_NAME']))) { return unserialize($r); } else { return false; } } else { return false; } } function mmc_send($o, $data, $server = 0) { if (!empty($o)) { if (!isset($GLOBALS['MEMCACHE'][$server])) { $GLOBALS['MEMCACHE'][$server] = memcache_connect($GLOBALS['_config']['memcached_host'][$server], 0); } memcache_set( $GLOBALS['MEMCACHE'][$server], md5($o . $_SERVER['SERVER_NAME']), serialize($data), $GLOBALS['_config']['memcached_compress'], $GLOBALS['_config']['memcached_time'] ); } } function mmc_replace($o, $data, $server = 0) { if (!empty($o)) { if (!isset($GLOBALS['MEMCACHE'][$server])) { $GLOBALS['MEMCACHE'][$server] = memcache_connect($GLOBALS['_config']['memcached_host'][$server], 0); } memcache_replace( $GLOBALS['MEMCACHE'][$server], md5($o . $_SERVER['SERVER_NAME']), serialize($data), $GLOBALS['_config']['memcached_compress'], $GLOBALS['_config']['memcached_time'] ); } } function read_mysql($q, $server = 0) { if (!empty($q)) { if (!isset($GLOBALS['MYSQL'][$server])) { $GLOBALS['MYSQL'][$server] = mysqli_connect($GLOBALS['_config']['mysql_host'][$server], $GLOBALS['_config']['mysql_user'][$server], $GLOBALS['_config']['mysql_pass'][$server], $GLOBALS['_config']['mysql_database'][$server]); } if ($r = mysqli_query($GLOBALS['MYSQL'][$server], $q)) { if ($r->num_rows > 0) { $d = array(); while ($row = mysqli_fetch_assoc($r)) { $d[] = $row; } return $d; } else { return false; } } else { return false; } } else { return false; } } function last_mysql_id($server = 0) { if (isset($GLOBALS['MYSQL'][$server])) { if (!empty($GLOBALS['MYSQL'][$server]->insert_id)) { return $GLOBALS['MYSQL'][$server]->insert_id; } else { return false; } } else { return false; } } function send_mysql($q, $server = 0) { if (!empty($q)) { if (!isset($GLOBALS['MYSQL'][$server])) { $GLOBALS['MYSQL'][$server] = mysqli_connect($GLOBALS['_config']['mysql_host'][$server], $GLOBALS['_config']['mysql_user'][$server], $GLOBALS['_config']['mysql_pass'][$server], $GLOBALS['_config']['mysql_database'][$server]); } mysqli_query($GLOBALS['MYSQL'][$server], $q); } } function encrypt($key, $value) { return base64_encode(openssl_encrypt($value, "AES-128-CBC", $key, 0, substr(md5($key), 0, 16))); } function decrypt($key, $value) { return openssl_decrypt(base64_decode($value), "AES-128-CBC", $key, 0, substr(md5($key), 0, 16)); } function send_mail($to, $to_name, $subject, $body) { require_once("Mail.php"); $to = $to_name . " <" . $to . ">"; $headers = array( 'From' => $GLOBALS['_config']['email_name'] . " <" . $GLOBALS['_config']['email'] . ">", 'To' => $to, 'Subject' => $subject, ); $smtp = Mail::factory( 'smtp', array( 'host' => $GLOBALS['_config']['email_host'], 'auth' => true, 'username' => $GLOBALS['_config']['email_login'], 'password' => $GLOBALS['_config']['email_pass'], ) ); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { //return($mail->getMessage()); return false; } else { return true; } } ?>
Output for 7.4.0 - 7.4.1
Notice: Undefined variable: _sys in /in/2pfMl on line 3 Notice: Trying to access array offset on value of type null in /in/2pfMl on line 3 Notice: Trying to access array offset on value of type null in /in/2pfMl on line 3
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13
Notice: Undefined variable: _sys in /in/2pfMl on line 3

preferences:
114.89 ms | 402 KiB | 157 Q