3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '20\' Container 1, 40\' Open Container 1, 40-45\' Closed Container 3, container roll 10, container lift 50'; preg_match_all('/(\d*\'*)\s([a-zA-Z ]+)(\d+)/', $str, $matches); unset($matches[0]); $res =[]; foreach($matches[1] as $key => $val){ $res[] = array_column($matches, $key); } var_dump($res);
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.4.16, 8.5.0 - 8.5.1
array(5) { [0]=> array(3) { [0]=> string(3) "20'" [1]=> string(10) "Container " [2]=> string(1) "1" } [1]=> array(3) { [0]=> string(3) "40'" [1]=> string(15) "Open Container " [2]=> string(1) "1" } [2]=> array(3) { [0]=> string(3) "45'" [1]=> string(17) "Closed Container " [2]=> string(1) "3" } [3]=> array(3) { [0]=> string(0) "" [1]=> string(15) "container roll " [2]=> string(2) "10" } [4]=> array(3) { [0]=> string(0) "" [1]=> string(15) "container lift " [2]=> string(2) "50" } }
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
216.09 ms | 408 KiB | 5 Q