3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = array( '<title>Something (TV 1999-2000)</title>' ,'<title>Something (1999-2000)</title>' ,'<title>Something (19999-2000)</title>' ,'<title>Something (99000)</title>' ,'<title>Something (2000)</title>' ); $regex = "/<title>.*?\(.*?(\d{4}(-\d{4})?).*?\)<\/title>/is"; foreach($items AS $k => $str) { preg_match($regex, $str, $matches[$k]); } print_r($matches); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => <title>Something (TV 1999-2000)</title> [1] => 1999-2000 [2] => -2000 ) [1] => Array ( [0] => <title>Something (1999-2000)</title> [1] => 1999-2000 [2] => -2000 ) [2] => Array ( [0] => <title>Something (19999-2000)</title> [1] => 1999 ) [3] => Array ( [0] => <title>Something (99000)</title> [1] => 9900 ) [4] => Array ( [0] => <title>Something (2000)</title> [1] => 2000 ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.81 ms | 402 KiB | 8 Q