# use

The ->use() method for the SurrealDB SDK for PHP switches to a specific namespace and database.

Switch to a specific namespace and database. If only the ns or db property is specified, the current connection details will be used to fill the other property.

```php title="Method Syntax"
$db->use([ "namespace" => "...", "database" => "..." ]);
```

## Arguments
<table>
    <thead>
        <tr>
            <th colspan="2" scope="col">Arguments</th>
            <th colspan="2" scope="col">Description</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td colspan="2" scope="row" data-label="Arguments">
                <code>namespace</code>
                <label label="initially required" />
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Switches to a specific namespace.
            </td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Arguments">
                <code>database</code>
                <label label="initially required" />
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Switches to a specific database.
            </td>
        </tr>
    </tbody>
</table>

## Example usage
```php
$db->use([
    "namespace" => "surrealdb",
    "database" => "docs"
]);
```
