note 46061 deleted from function.ocibindbyname by sixd

From: Date: Wed, 20 Nov 2013 19:49:31 +0000
Subject: note 46061 deleted from function.ocibindbyname by sixd
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197595@lists.php.net to get a copy of this message
Note Submitter: md AT opencube DOT org ---- I changed the Method below - all without comments: function getBindVars($statement){ $regExp = "/(:[_a-z0-9]+)/i"; $statement = preg_replace('/\'[^\']*?\'/i', "", $statement); // --- Kommentare raus: $statement = preg_replace('/--[^(\n)]*?\n/i', "", $statement."\n"); // /* */ Kommentare raus: $statement = preg_replace('/(\/\*)([^\*]|[^\*](\*)[^\/])+?(\*\/)/i', "", $statement); $statement = preg_replace('/[^s]el([^t](t)[^s])+?(ts)/i', "", $statement); $test = preg_match_all($regExp, $statement, $return); if (isset($return[1]) && count($return[1]) > 0) return($return[1]); else return array(); } for this statement: $testStatement = " select * from /* Komm \n* :v_comment /asdf */ elements := [asdf]||test where\n elements_id = :v_test;". "(:value-1) ':text[not]text'||:test123 --test 'diesen:auch_nicht' :v_not\n asdf"; we get this Array: Array ( [0] => :v_test [1] => :value [2] => :test123 )

« previous php.notes (#197595) next »