ummm...yes. Use SQL. Don't use PHP.
One *POSSIBLE* example:
CREATE table_backup LIKE my_table;
INSERT INTO table_backup
SELECT * FROM my_table;
But there are many many many other possibilities.
DO NOT USE PHP FOR THIS!
(You can use PHP, but use SQL queries to move/copy the data!)