3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "(联想 OR 戴尔 OR 苹果 OR 宏基) dangers:deep1条 dangers:(newuuid deep1条 FirstTimeImageRule) 价格_i:[1500 TO 2500] cityEnglishName:beijing categoryEnglishName:bijiben"; if (preg_match_all('/([a-zA-Z]+)\:\(([^\)]+)\)/', $str, $m)) { for ($i = 0; $i < count($m[0]); $i++) { $q = trim($m[0][$i]); if (strlen($q) == 0) continue; $key = $m[1][$i]; $qq = explode(" OR ", $m[2][$i]); if (count($qq) > 1) { $op = " OR "; } else { $qq = explode(" AND ", $m[2][$i]); if (count($qq) <= 1) { $qq = explode(" ", $m[2][$i]); } $op = " AND "; } foreach ($qq as $k => $v) { $qq[$k] = "{$key}:{$v}"; } $str = str_replace($q, "(" . implode($op, $qq) . ")", $str); } } var_dump($str);
Output for git.master, git.master_jit, rfc.property-hooks
string(201) "(联想 OR 戴尔 OR 苹果 OR 宏基) dangers:deep1条 (dangers:newuuid AND dangers:deep1条 AND dangers:FirstTimeImageRule) 价格_i:[1500 TO 2500] cityEnglishName:beijing categoryEnglishName:bijiben"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
37.85 ms | 401 KiB | 8 Q