3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lookup = [ '#online' => 'System is operating at peak performance.', '#performancedegradation' => 'Performance is slower than normal.', '#directonly' => 'Traffic is bypassing Smart CDN system, and going directly to websites.' ]; $regex = '/^(?:' . implode('|', array_keys($lookup)) . ')(?=\s)/m'; $contents = <<<TEXT #online System is operating at peak performance. #directonly Traffic is bypassing Smart CDN system, and going directly to websites. TEXT; $matches = preg_match_all($regex, $contents, $m) ? $m[0] : []; foreach ($matches as $keyword) { printf( '<div class="badge_subpage_system"><h5>%s</h5><p>%s</p></div>', $keyword, $lookup[$keyword] ); echo "\n"; }
Output for 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.26, 8.4.1 - 8.4.13
<div class="badge_subpage_system"><h5>#online</h5><p>System is operating at peak performance.</p></div> <div class="badge_subpage_system"><h5>#directonly</h5><p>Traffic is bypassing Smart CDN system, and going directly to websites.</p></div>

preferences:
163.53 ms | 407 KiB | 5 Q