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"; }

preferences:
28.38 ms | 407 KiB | 5 Q