public function getSqlFileTables($path)
    {
        $tables = array();

        if(file_exists($path)) {
            $file = fopen($path, 'r');
            $textToFind = 'CREATE TABLE IF NOT EXISTS ';
            $found = array();
            $tables = array();
            while(!feof($file)) {
                $output = fgets($file);
                $pos = strrpos($output, $textToFind);
                if(is_int($pos)) {
                    $found[] = $output;
                }
            }

            foreach($found as $table) {
                $startPos = strpos($table, '`');
                $lastPos = strrpos($table, '`');
                $tableName = substr($table, $startPos, $lastPos);
                $tableName = preg_replace('/\(|\)/', '', $tableName);
                $tables[] = trim(str_replace('`', '', $tableName));
            }
        }

        return $tables;
    }
public function getSqlFileTables($path)
    {
        $tables = array();

        if(file_exists($path)) {
            $file = fopen($path, 'r');
            $textToFind = 'CREATE TABLE IF NOT EXISTS ';
            $found = array();
            $tables = array();
            while(!feof($file)) {
                $output = fgets($file);
                $pos = strrpos($output, $textToFind);
                if(is_int($pos)) {
                    $found[] = $output;
                }
            }

            foreach($found as $table) {
                $startPos = strpos($table, '`');
                $lastPos = strrpos($table, '`');
                $tableName = substr($table, $startPos, $lastPos);
                $tableName = preg_replace('/\(|\)/', '', $tableName);
                $tables[] = trim(str_replace('`', '', $tableName));
            }
        }

        return $tables;
    }
public function getSqlFileTables ( $ path ) { $ tables = array ( ) ; if ( file_exists ( $ path ) ) { $ file = fopen ( $ path , 'r' ) ; $ textToFind = 'CREATE TABLE IF NOT EXISTS ' ; $ found = array ( ) ; $ tables = array ( ) ; while ( ! feof ( $ file ) ) { $ output = fgets ( $ file ) ; $ pos = strrpos ( $ output , $ textToFind ) ; if ( is_int ( $ pos ) ) { $ found [ ] = $ output ; } } foreach ( $ found as $ table ) { $ startPos = strpos ( $ table , '`' ) ; $ lastPos = strrpos ( $ table , '`' ) ; $ tableName = substr ( $ table , $ startPos , $ lastPos ) ; $ tableName = preg_replace ( '/\(|\)/' , '' , $ tableName ) ; $ tables [ ] = trim ( str_replace ( '`' , '' , $ tableName ) ) ; } } return $ tables ; }
Returns all the table names that will be imported
@param String $path
@return array
Returns all the table names that will be imported