3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '[a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="344747585151010c745359555d581a575b59"]'; function bb_parse($string) { $tags = 'b|i|size|color|center|quote|url|img'; while (preg_match_all('`\[('.$tags.')=?(.*?)\](.+?)\[/\1\]`', $string, $matches)) foreach ($matches[0] as $key => $match) { list($tag, $param, $innertext) = array($matches[1][$key], $matches[2][$key], $matches[3][$key]); switch ($tag) { case 'b': $replacement = "<strong>$innertext</strong>"; break; case 'i': $replacement = "<em>$innertext</em>"; break; case 'size': $replacement = "<span style=\"font-size: $param;\">$innertext</span>"; break; case 'color': $replacement = "<span style=\"color: $param;\">$innertext</span>"; break; case 'center': $replacement = "<div class=\"centered\">$innertext</div>"; break; case 'quote': $replacement = "<blockquote>$innertext</blockquote>" . $param? "<cite>$param</cite>" : ''; break; case 'url': $replacement = '<a href="' . ($param? $param : $innertext) . "\">$innertext</a>"; break; case 'img': list($width, $height) = preg_split('`[Xx]`', $param); $replacement = "<img src=\"$innertext\" " . (is_numeric($width)? "width=\"$width\" " : '') . (is_numeric($height)? "height=\"$height\" " : '') . '/>'; break; case 'video': $videourl = parse_url($innertext); parse_str($videourl['query'], $videoquery); if (strpos($videourl['host'], 'youtube.com') !== FALSE) $replacement = '<embed src="http://www.youtube.com/v/' . $videoquery['v'] . '" type="application/x-shockwave-flash" width="425" height="344"></embed>'; if (strpos($videourl['host'], 'google.com') !== FALSE) $replacement = '<embed src="http://video.google.com/googleplayer.swf?docid=' . $videoquery['docid'] . '" width="400" height="326" type="application/x-shockwave-flash"></embed>'; break; } $string = str_replace($match, $replacement, $string); } return $string; } echo bb_parse($string);
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
[a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="344747585151010c745359555d581a575b59"]
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 [a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="344747585151010c745359555d581a575b59"]

preferences:
150.91 ms | 402 KiB | 163 Q