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|$)/im"; $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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2b12V
function name:  (null)
number of ops:  11
compiled vars:  !0 = $pattern, !1 = $sql, !2 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%28SELECT%7CFROM%7CWHERE%7CLEFT+JOIN%7CORDER+BY%29%28.%2B%3F%29%28%3F%3D+SELECT%7CFROM%7CWHERE%7CLEFT+JOIN%7CORDER+BY%7C%24%29%2Fim'
    5     1        ASSIGN                                                   !1, 'Select+%0A++++++++++++id%2C+%0A++++++++++++nome+%0A++++++++FROM+table+as+t+%0A++++++++WHERE+t.id+%3D+123+%0A++++++++++++LEFT+JOIN+t2+ON+t2.id+%3D+t.id+%0A++++++++ORDER+BY+t.name%0A++++++++'
   14     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   16     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.34 ms | 1385 KiB | 17 Q