# alch\_get\_option

Function `alch_get_option` returns the value of a saved option.

For client-side use [getOption](/v0.9/javascript/get_option.md).

## Parameters

The function takes `$optionID` and `$default` as parameters. `$optionID` should match the `id` of some field in the main [configuration object](/v0.9/configuration.md).

## Return values

Return value can be of several types, depending on the [type of the field](/v0.9/fields.md).

## Example

```php
    $myVal = alch_get_option( 'field-id', 'Some default value' );
```

If `field-id` has a value in the database, it will be assigned to the `$myVal` variable, otherwise, `$myVal` will be `Some default value`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.alchemy-options.com/v0.9/functions/alch_get_option.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
