serialize

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Generates a storable representation of a value
<?php serialize(mixed $value): string
<?php     protected function serialize($value)

    {

        $serialized = serialize($value);



        return $this->connection instanceof PostgresConnection

            ? base64_encode($serialized)
<?php     protected function serialize($value)

    {

        return serialize($value);

    }
<?php             $job = CallQueuedClosure::create($job);

        }



        return serialize($job);

    }
<?php         );



        if (collect($expectedChain)->contains(fn ($job) => is_object($job))) {

            $expectedChain = collect($expectedChain)->map(fn ($job) => serialize($job))->all();

        } else {

            $chain = collect($this->chained)->map(fn ($job) => get_class(unserialize($job)))->all();

        }
<?php     public function put($key, $value, $seconds)

    {

        $this->storage[$key] = [

            'value' => $this->serializesValues ? serialize($value) : $value,

            'expiresAt' => $this->calculateExpiration($seconds),

        ];
<?php     {

        if (! is_null($existing = $this->get($key))) {

            return tap(((int) $existing) + $value, function ($incremented) use ($key) {

                $value = $this->serializesValues ? serialize($incremented) : $incremented;



                $this->storage[$key]['value'] = $value;

            });
<?php     protected function serialize($value)

    {

        $result = serialize($value);



        if ($this->connection instanceof PostgresConnection && str_contains($result, "\0")) {

            $result = base64_encode($result);
<?php     protected function serialize($value)

    {

        return is_numeric($value) ? (string) $value : serialize($value);

    }
<?php         $this->ensureCacheDirectoryExists($path = $this->path($key));



        $result = $this->files->put(

            $path, $this->expiration($seconds).serialize($value), true

        );



        if ($result !== false && $result > 0) {
<?php         if (empty($expire) || $this->currentTime() >= $expire) {

            $file->truncate()

                ->write($this->expiration($seconds).serialize($value))

                ->close();



            $this->ensurePermissionsAreCorrect($path);
<?php     protected function serialize($value)

    {

        return is_numeric($value) && ! in_array($value, [INF, -INF]) && ! is_nan($value) ? $value : serialize($value);

    }
<?php         $iv = random_bytes(openssl_cipher_iv_length(strtolower($this->cipher)));



        $value = \openssl_encrypt(

            $serialize ? serialize($value) : $value,

            strtolower($this->cipher), $this->key, 0, $iv, $tag

        );
<?php         $instance->events->dispatch(new Dehydrating($instance));



        $serialize = fn ($value) => serialize($instance->getSerializedPropertyValue($value, withRelations: false));



        return $instance->isEmpty() ? null : [

            'data' => array_map($serialize, $instance->all()),
<?php         return [

            'sent' => $this->sent,

            'data' => $hasAttachments ? base64_encode(serialize($this->data)) : $this->data,

            'hasAttachments' => $hasAttachments,

        ];

    }
<?php         return [

            'hasAttachments' => $hasAttachments,

            'sentMessage' => $hasAttachments ? base64_encode(serialize($this->sentMessage)) : $this->sentMessage,

        ];

    }