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|$)/m"; $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, PREG_SET_ORDER); var_dump($arr);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> array(3) { [0]=> string(16) "FROM table as t " [1]=> string(4) "FROM" [2]=> string(11) "table as t " } [1]=> array(3) { [0]=> string(17) "WHERE t.id = 123 " [1]=> string(5) "WHERE" [2]=> string(11) "t.id = 123 " } [2]=> array(3) { [0]=> string(29) "LEFT JOIN t2 ON t2.id = t.id " [1]=> string(9) "LEFT JOIN" [2]=> string(19) "t2 ON t2.id = t.id " } [3]=> array(3) { [0]=> string(15) "ORDER BY t.name" [1]=> string(8) "ORDER BY" [2]=> 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:
59.62 ms | 402 KiB | 8 Q