If you have permission to use make "exec" system calls you can do something like the following
exec("mysql -u".$DB_USER." --password='".$DB_PASS."' -e 'DROP DATABASE IF EXISTS `".$NEW_DB."`; CREATE DATABASE `".$NEW_DB."`;'");
exec("mysqldump -u".$DB_USER." -p'".$DB_PASS."' ".$EXISTING_DB." | mysql -u ".$DB_USER." --password='".$DB_PASS."' ".$NEW_DB);
This will drop $NEW_DB if present, and recreate it, then dump all tables and data from $EXISTING_DB into $NEW_DB
Disclaimer: It is generally not a good idea to pass your mysql password on the command line. I am not sure, but I would guess that this could probably be viewed by someone with root access who has the ability to view all processes and the command line options that started them.
Also, in terms of your other question about how to create a table in a new database with columns matching another, you can use the following SQL
CREATE TABLE new_database.new_table LIKE old_database.old_table