3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "age<21,length>10,height<>10,width!=100,name='Emma Einarsson' or it can be words time>=10,clouds<=4", "age < 21, length > 10, height <> 10, width != 100, name = 'Emma Einarsson' or it can be words time >= 10, clouds <= 4", "My name is Emma and i have a dillemma, what's the distance between 'New York' and 'Athene' ?", "'New York' and London at the start and end with Paris and 'Los Angeles'" ]; foreach ($strings as $string) { var_export(preg_match_all("~\B'\K(?:[^']+)|\b[a-z']+\b|\d+|[<>!=?]+~i", $string, $out) ? $out[0] : 'fail'); echo "\n"; }

preferences:
139.08 ms | 405 KiB | 5 Q