I have a simple associative array such as:
key1 => array('table' =>'table1',columns=>array(column1,column2 etc))
When I step through this array with a foreach loop, as below, I cannot seem to call the table name value and insert it into a string I intend to use to make a SQL call.
foreach($tables as $table=>$columnsArray){
echo $columnsArray['table'];
$sql="DROP TABLE $columnsArray['table']";
}
I'm obviously doing something wrong, but I cannot fathom what.
If I write $tableName=$columnsArray['table'];
I can use that value in $tableName
within my string without problem.
Please can someone point out what I am doing wrong ?