how to correctly write drush sql-sycn using drush_invoke_process()
From your php code:

$values = drush_invoke_process('@none', 'sql-sync', array('@site1', '@site2'), array('tables-list' =&gt; 'table1,table2,tableN'));


$values will be an array containing various interesting information about the Drush call.  In particular, check $values['error'] to see if the command succeeded or not.