3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = '/NameType /FlateDecode /Contents[4 0 R 42]/Fonts<</F1 41/F2 43>>/NullType null/StringType(hello))/DateType(D:20130901235555+02\'00\')/XRefType 2 0 R /NumericType 8/HexaType<0020>/BooleanType false'; if (preg_match('/^\s*\((?P<name>.*)/s', $content, $match)) { } $offset=0; if (preg_match('/^\s*\((?P<name>.*)/s', $content, $match)) { $name = $match['name']; // Find next ')' not escaped. $cur_start_text = $start_search_end = 0; while (($cur_start_pos = strpos($name, ')/', $start_search_end)) !== false) { $cur_extract = substr($name, $cur_start_text, $cur_start_pos - $cur_start_text); preg_match('/(?P<escape>[\\\]*)$/s', $cur_extract, $match); if (!(strlen($match['escape']) % 2)) { break; } $start_search_end = $cur_start_pos + 1; } // Extract string. $name = substr($name, 0, $cur_start_pos); $offset += strpos($content, '(') + $cur_start_pos + 2; // 2 for '(' and ')' $name = str_replace( array('\\\\', '\\ ', '\\/', '\(', '\)', '\n', '\r', '\t'), array('\\', ' ', '/', '(', ')', "\n", "\r", "\t"), $name ); print_r($name); } // your code goes here echo "test";
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 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.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
test

preferences:
194.83 ms | 405 KiB | 350 Q