Cloud Spanner Client - Class Bytes (1.57.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;

Methods

__construct

Parameter
NameDescription
value string|resource|Psr\Http\Message\StreamInterface

The bytes value.

get

Get the bytes as a stream.

Example:

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

type

Get the type.

Example:

echo $bytes->type();
Returns
TypeDescription
int

formatAsString

Format the value as a string.

Example:

echo $bytes->formatAsString();
Returns
TypeDescription
string

__toString

Format the value as a string.

Returns
TypeDescription
string