• Start

v1 (stable)

/

Methods

run

The run method in the SurrealDB PHP SDK allows you to execute a defined SurrealQL function on the remote database.

Runs a defined SurrealQL function on the remote database.

Method Syntax
$db->run($function, $version, $params);

Arguments

Type

Description

$functionstring

The name of the function to run.

$version

string or null

The version of the function to run.

$params

array or null

An array of parameters to pass to the function.

Example
$functionA = $db->run("fn::hello_world", null, ["Tobie"]);
$functionB = $db->run("fn::hello_world", "v1", ["Tobie"]);

// or with named arguments
$functionA = $db->run("fn::hello_world", params: ["Tobie"]);
$functionB = $db->run("fn::hello_world", version: "v1", params: ["Tobie"]);

Was this page helpful?