:
substr($statement->queryString, 0, strpos($statement->queryString, ' '));
where $ statement is a PDOStatement object, there are a few things to note before using this that $ statement is a PDOStatement object, we should probably also take strpos from the substr operator in case strpos returns false, which will probably cause an error, finally, it only works with one type of word operators, such as SELECT, INSERT, etc., and not with several types of statements, such as ALTER TABLE
source
share