3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ 'CPC >= $0 (Yesterday)', 'CPC (Link) > $100 (Today)' ]; foreach ($strings as $string) { list($metric, $sign, $digit, $time) = preg_match('~([\w ()]+) ([><]=?) \$(\d+) \(([^)]+)\)~', $string, $out) ? array_slice($out, 1) : ['', '', '', '']; echo "metric: $metric, sign: $sign, digit: $digit, time: $time\n"; var_export($metric); // notice no leading or trailing spaces / unwanted characters in the output echo "\n"; var_export($sign); // notice no leading or trailing spaces / unwanted characters in the output echo "\n"; var_export($digit); // notice no leading or trailing spaces / unwanted characters in the output echo "\n"; var_export($time); // notice no leading or trailing spaces / unwanted characters in the output echo "\n----------\n"; }

preferences:
32.51 ms | 406 KiB | 5 Q