3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = "/(SELECT|FROM|WHERE|LEFT JOIN|ORDER BY) (.+?)(?= SELECT|FROM|WHERE|LEFT JOIN|ORDER BY|$)/ims"; $sql = "Select id, nome FROM table as t WHERE t.id = 123 LEFT JOIN t2 ON t2.id = t.id ORDER BY t.name "; preg_match_all($pattern, $sql, $arr); var_dump($arr);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(5) { [0]=> string(24) "Select id, " [1]=> string(16) "FROM table as t " [2]=> string(17) "WHERE t.id = 123 " [3]=> string(29) "LEFT JOIN t2 ON t2.id = t.id " [4]=> string(15) "ORDER BY t.name" } [1]=> array(5) { [0]=> string(6) "Select" [1]=> string(4) "FROM" [2]=> string(5) "WHERE" [3]=> string(9) "LEFT JOIN" [4]=> string(8) "ORDER BY" } [2]=> array(5) { [0]=> string(17) " id, " [1]=> string(11) "table as t " [2]=> string(11) "t.id = 123 " [3]=> string(19) "t2 ON t2.id = t.id " [4]=> string(6) "t.name" } }

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:
89.7 ms | 402 KiB | 8 Q