Cloud Spanner Client - Class Bytes (1.77.0)

Reference documentation and code samples for the Cloud Spanner Client class Bytes.

Represents a value with a data type of bytes.

Example:

use Google\Cloud\Spanner\SpannerClient;

$spanner = new SpannerClient();

$bytes = $spanner->bytes('hello world');
// Byte instances can be cast to base64-encoded strings.
echo (string) $bytes;

Namespace

Google \ Cloud \ Spanner

Methods

__construct

Parameter
Name Description
value string|resource|Psr\Http\Message\StreamInterface

The bytes value.

get

Get the bytes as a stream.

Example:

$stream = $bytes->get();
Returns
Type Description
Psr\Http\Message\StreamInterface

type

Get the type.

Example:

echo $bytes->type();
Returns
Type Description
int

formatAsString

Format the value as a string.

Example:

echo $bytes->formatAsString();
Returns
Type Description
string

__toString

Format the value as a string.

Returns
Type Description
string