3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<<TEXT A number 555555555 then some more text and a quoted number "(123)4567890" and then 1 2 3 4 6 (54) 3 -2 and forward slashed /+--------0/ versus +--------0 then something more realistic '234 588 9191' no more text. This is not closed by the same character on both ends: "+012345678901/ which of course is a _necessary_ check? TEXT; echo preg_replace('~([\'"/])\+?[\d()\s-]{8,25}\d{1,2}\1(*SKIP)(*FAIL)|((?!\s)\+?[\d()\s-]{8,25}\d{1,2})~', "<strong>$2</strong>", $text);
Output for 7.1.25 - 7.1.32, 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.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
A number <strong>555555555</strong> then some more text and a quoted number "(123)4567890" and then <strong>1 2 3 4 6 (54) 3 -2</strong> and forward slashed /+--------0/ versus <strong>+--------0</strong> then something more realistic '234 588 9191' no more text. This is not closed by the same character on both ends: "<strong>+012345678901</strong>/ which of course is a _necessary_ check?

preferences:
312.73 ms | 1550 KiB | 4 Q