3v4l.org

run code in 300+ PHP versions simultaneously
<?php $output = 'tag: 7.x-2.x-1511112-53-combined tag: 7.x-2.x-1511112-50-static-cache-per-git-dir HEAD, tag: xxxx, origin/HEAD, origin/7.x-2.x, 7.x-2.x tag: 7.x-3.0--alpha5 tag: 7.x-2.2 tag: 7.x-2.1 tag: 7.x-2.0'; $lines = explode("\n", $output); $tag = NULL; foreach ($lines as $line) { $parts = explode(', ', $line); foreach ($parts as $part) { if (preg_match('/^tag: (\d+\.x\-\d+\.\d+(?:|\-\w+\d+))$/', $part, $m)) { $tag = $m[1]; break 2; } } } var_export($tag);
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.5, 7.4.7 - 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.26, 8.4.1 - 8.4.13
'7.x-2.2'
Output for 7.4.6
'7.x-2.2' _init has set a custom offset: 1574730388, diff.tv_sec=15168350 diff.tv_usec=869166 gettimeofday using offset: 15168350.877286, returning 1574730388.000100

preferences:
46.33 ms | 407 KiB | 5 Q