PHP: How do I find (Oracle) parameters in a SQL query?
        Posted  
        
            by Bartb
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Bartb
        
        
        
        Published on 2010-05-19T09:02:46Z
        Indexed on 
            2010/05/19
            9:10 UTC
        
        
        Read the original article
        Hit count: 210
        
Suppose you have a string: "SELECT * FROM TABLE WHERE column1 = :var1 AND column2 = :var2"
Now, how do I get an array with all the variables like so:
Array
(
     [0] => :var1
     [1] => :var2
)
I've tried it with PHP's preg_match_all, but I struggle with the regex.
$varcount = preg_match_all("/ :.+ /", $sql, $out);
© Stack Overflow or respective owner