PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $func_id = 'AibolitHelpers::myCheckSum'; $sigs = array(); $sigs[0] = '(eval|system|exec)cat'; $sigs[1] = '(eval|system|exec)dog'; $txt = implode("\n", $sigs); for ($i = 24; $i >= 1; ($i > 4) ? $i -= 4 : --$i) { $txt = preg_replace_callback('#^((?>(?:\\\\.|\\[.+?\\]|[^(\n]|\((?:\\\\.|[^)(\n])++\))(?:[*?+]\+?|\{\d+(?:,\d*)?\}[+?]?|)){' . $i . ',})[^\n]*+(?:\\n\\1(?![{?*+]).+)+#im', 'optMergePrefixes', $txt); } function optMergePrefixes($m) { var_dump($m); $limit = 8000; $prefix = $m[1]; $prefix_len = strlen($prefix); $len = $prefix_len; $r = []; $suffixes = []; foreach (explode("\n", $m[0]) as $line) { if (strlen($line) > $limit) { print("== ".$line); $r[] = $line; continue; } $s = substr($line, $prefix_len); $len += strlen($s); if ($len > $limit) { if (count($suffixes) == 1) { $r[] = $prefix . $suffixes[0]; } else { $r[] = $prefix . '(?:' . implode('|', $suffixes) . ')'; } $suffixes = []; $len = $prefix_len + strlen($s); } $suffixes[] = $s; } if (!empty($suffixes)) { if (count($suffixes) == 1) { $r[] = $prefix . $suffixes[0]; } else { $r[] = $prefix . '(?:' . implode('|', $suffixes) . ')'; } } return implode("\n", $r); } var_dump($txt);
Show:  
Copy Clear