Say I have an array of table DDL queries and I want to get the name of each table being created. What would the best approach be for extracting the table name?
So for example:
$ddl = array(
'CREATE TABLE tableOne ...',
'CREATE TABLE tableTwo ...',
'CREATE TABLE tableThree ...'
);
foreach($ddl as $tableDef) {
$tableName = [???];
echo $tableName;
}
That's just a simplified case, but I'm wondering how I would parse out the table name. Is it safe to assume it is whatever comes after "CREATE TABLE "? Are there any special cases I should be aware of?