3v4l.org

run code in 300+ PHP versions simultaneously
<pre> <?php error_reporting(E_ALL); ini_set('display_errors', '1'); //http://stackoverflow.com/questions/1777101/php-check-to-see-if-a-string-matches-a-pattern require_once 'core.php'; if (!function_exists('rip') || !isset($_FILE)) die('can\'t rip'); /*start working...*/ init(); $a = getData(); if ($a === true) startSelect(); print_r(getDebug()); function init(){ global $_URL, $_CACHER, $_FILE, $_DATA; $_URL = file($_FILE); parseLines($_URL); $_CACHER['url'] = &$_URL; $_CACHER['count'] = array(); //$_CACHER['data'] = &$_DATA; return true; } function getData(){ global $_DATA, $_URL, $_CACHER, $_FPENDING, $_FALL, $_FSELECTED; if (is_file($_FPENDING){ unset($_CACHER['url']); unset($_CACHER['count']); $_CACHER['status'] = 'from_cache_see_pending'; return false; } @mkdir('tmp/' . date("Y-m-d"), 0777); @unlink($_FALL); foreach ($_URL as $val){ $data = getFromUrl($val); $_CACHER['count'][] = count($data); //$_DATA[] = $data; file_put_contents($_FALL, implode("\n", $data), FX_LOCK | FILE_APPEND); } $_CACHER['status'] = 'from_extern_cache_writed'; return true; } function startSelect(){ global $_PATT, $_FPENDING, $_FALL, $_FSELECTED; $list = file($_FALL); $good = array(); foreach ($list as $val){ foreach ($_PATT as $pat){ if (preg_match($pat, $val)){ $good[] = trim($val); } } } file_put_contents($_FSELECTED, implode("\n", $good));//only from patters file_put_contents($_FPENDING, implode("\n", $good));//pattern + human. } function getFromUrl($url){ $data = file_get_contents($url); $data = explode("\n", $data); foreach ($data as &$val){ $val = getCleared($val); } return $data; } function getCleared($val){ return trim($val); } function parseLines(&$a){ if (!is_array($a)) return false; foreach ($a as $k => $value){ $a[$k] = (getProp($value)); } return $a; } function getProp($text){ $text = preg_replace_callback("/\[(.*?)\]/", "callback", $text); return $text; } function callback($ok){ $ok = end($ok); $rez = ''; eval('$rez = ' . $ok . ';'); return $rez; }
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.19
Parse error: syntax error, unexpected '{' in /in/7622M on line 29
Process exited with code 255.

preferences:
173.16 ms | 1395 KiB | 55 Q