3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "21-114512", "test12345abcd", "12test123456testing", "123456", "1234", "12345a67890" ]; function extract_numbers($string) { return preg_match_all('/(?<!\d)\d{5,6}(?!\d)/', $string, $match) ? $match[0] : []; } foreach ($strings as $string) { var_export(extract_numbers($string)); echo "\n---\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => '114512', ) --- array ( 0 => '12345', ) --- array ( 0 => '123456', ) --- array ( 0 => '123456', ) --- array ( ) --- array ( 0 => '12345', 1 => '67890', ) ---

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:
18.75 ms | 401 KiB | 8 Q