(PHP 5 &gt;= 5.1.0)<br/>
String representation of object
@link http://php.net/manual/en/serializable.serialize.php
@return string the string representation of the object or null
181052
public function serialize()
    {
        return serialize([$this->container, $this->userList, $this->database, $this->connection]);
    }
274262
public function toString()
    {
        $status = sprintf('HTTP/%s %d %s', $this->getVersion(), $this->getStatusCode(), $this->getStatusMessage());

        $str  = trim($status) . "\r\n";
        $str .= $this->getHeaders();
        $str .= "\r\n";
        $str .= $this->getContent();
        return $str;
    }
574699
public function serialize()
    {
        $serialized = $this->__serialize();

        if (null === $isCalledFromOverridingMethod = \func_num_args() ? \func_get_arg(0) : null) {
            $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
            $isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
        }

        return $isCalledFromOverridingMethod ? $serialized : serialize($serialized);
    }
1041142
public function serialize()
    {
        if ($this->response) {
            return serialize((string) $this->response->getBody());
        }

        return serialize(null);
    }
39136
public function toString()
    {
        $data = $this->toArray();

        // Root should be JSON object, not array
        if (count($data) === 0) {
            $data = new ArrayObject();
        }

        // Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
        $data = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES);

        if (JSON_ERROR_NONE !== json_last_error())
        {
            throw new InvalidArgumentException(
                'Cannot encode data to JSON string: ' . json_last_error_msg()
            );
        }

        return $data;
    }
147520
public function toString()
    {
        $request = sprintf('%s %s HTTP/%s', $this->getMethod(), (string) $this->getUrl(), $this->getVersion());

        $str = trim($request) . "\r\n";
        $str .= $this->getHeaders();
        $str .= "\r\n";
        $str .= $this->getContent();
        return $str;
    }
563278
public function toString()
    {
        $output = 'data:';

        if (($this->getMediaType() !== self::DEFAULT_TYPE) || ($this->getEncoding() !== self::ENCODING_URL_ENCODED_OCTETS)) {
            $output .= $this->getMediaType();

            if ($this->getEncoding() === self::ENCODING_BASE64) {
                $output .= ';'.self::BASE64_KEYWORD;
            }
        }

        $output .= ','.$this->getEncodedData();

        return $output;
    }
890469
public function serialize()
	{
		// Load all of the inputs.
		$this->loadAllInputs();

		// Remove $_ENV and $_SERVER from the inputs.
		$inputs = $this->inputs;
		unset($inputs['env'], $inputs['server']);

		// Serialize the options, data, and inputs.
		return serialize(array($this->options, $this->data, $inputs));
	}
224129
public function serialize() {
		$attributes = array();

		if ( $this->visible ) {
			// If visible attributes are set, we'll only reveal those.
			foreach ( $this->visible as $key ) {
				$attributes[ $key ] = $this->get_attribute( $key );
			}
		} elseif ( $this->hidden ) {
			// If hidden attributes are set, we'll grab everything and hide those.
			foreach ( $this->get_attribute_keys() as $key ) {
				if ( ! in_array( $key, $this->hidden ) ) {
					$attributes[ $key ] = $this->get_attribute( $key );
				}
			}
		} else {
			// If nothing is hidden/visible, we'll grab and reveal everything.
			foreach ( $this->get_attribute_keys() as $key ) {
				$attributes[ $key ] = $this->get_attribute( $key );
			}
		}

		return array_map( function ( $attribute ) {
			if ( $attribute instanceof Serializes ) {
				return $attribute->serialize();
			}

			return $attribute;
		}, $attributes );
	}
1167525
public function serialize()
    {
        return serialize(array(
            'autoNumber'              =>  $this->autoNumber,
            'byteLength'              =>  $this->byteLength,
            'calculated'              =>  $this->calculated,
            'calculatedFormula'       =>  $this->calculatedFormula,
            'caseSensitive'           =>  $this->caseSensitive,
            'controllerName'          =>  $this->controllerName,
            'createable'              =>  $this->createable,
            'custom'                  =>  $this->custom,
            'defaultValueFormula'     =>  $this->defaultValueFormula,
            'defaultedOnCreate'       =>  $this->defaultedOnCreate,
            'dependentPicklist'       =>  $this->dependentPicklist,
            'deprecatedAndHidden'     =>  $this->deprecatedAndHidden,
            'digits'                  =>  $this->digits,
            'externalId'              =>  $this->externalId,
            'filterable'              =>  $this->filterable,
            'groupable'               =>  $this->groupable,
            'htmlFormatted'           =>  $this->htmlFormatted,
            'idLookup'                =>  $this->idLookup,
            'inlineHelpText'          =>  $this->inlineHelpText,
            'label'                   =>  $this->label,
            'length'                  =>  $this->length,
            'name'                    =>  $this->name,
            'nameField'               =>  $this->nameField,
            'namePointing'            =>  $this->namePointing,
            'nillable'                =>  $this->nillable,
            'permissionable'          =>  $this->permissionable,
            'picklistValues'          =>  $this->picklistValues,
            'precision'               =>  $this->precision,
            'referenceTo'             =>  $this->referenceTo,
            'relationshipName'        =>  $this->relationshipName,
            'relationshipOrder'       =>  $this->relationshipOrder,
            'restrictedPicklist'      =>  $this->restrictedPicklist,
            'scale'                   =>  $this->scale,
            'soapType'                =>  $this->soapType,
            'sortable'                =>  $this->sortable,
            'type'                    =>  $this->type,
            'unique'                  =>  $this->unique,
            'updateable'              =>  $this->updateable,
            'writeRequiresMasterRead' =>  $this->writeRequiresMasterRead
        ));
    }
159744
public function toString()
    {
        $headers = $this->toArray();
        $content = '';

        //Serialise the headers to a string
        foreach ($headers as $name => $value) {
            $content .= sprintf("%s %s\r\n", $name.':', $value);
        }

        return $content;
    }
1232228
public function serialize()
    {
        $str = 'BEGIN:'.$this->name."\r\n";

        /**
         * Gives a component a 'score' for sorting purposes.
         *
         * This is solely used by the childrenSort method.
         *
         * A higher score means the item will be lower in the list.
         * To avoid score collisions, each "score category" has a reasonable
         * space to accomodate elements. The $key is added to the $score to
         * preserve the original relative order of elements.
         *
         * @param int   $key
         * @param array $array
         *
         * @return int
         */
        $sortScore = function ($key, $array) {
            if ($array[$key] instanceof Component) {
                // We want to encode VTIMEZONE first, this is a personal
                // preference.
                if ('VTIMEZONE' === $array[$key]->name) {
                    $score = 300000000;

                    return $score + $key;
                } else {
                    $score = 400000000;

                    return $score + $key;
                }
            } else {
                // Properties get encoded first
                // VCARD version 4.0 wants the VERSION property to appear first
                if ($array[$key] instanceof Property) {
                    if ('VERSION' === $array[$key]->name) {
                        $score = 100000000;

                        return $score + $key;
                    } else {
                        // All other properties
                        $score = 200000000;

                        return $score + $key;
                    }
                }
            }
        };

        $children = $this->children();
        $tmp = $children;
        uksort(
            $children,
            function ($a, $b) use ($sortScore, $tmp) {
                $sA = $sortScore($a, $tmp);
                $sB = $sortScore($b, $tmp);

                return $sA - $sB;
            }
        );

        foreach ($children as $child) {
            $str .= $child->serialize();
        }
        $str .= 'END:'.$this->name."\r\n";

        return $str;
    }
425217
public function serialize()
    {
        return serialize([
            'key' => $this->key,
            'value' => $this->value,
            'expires' => $this->expires,
            'hit' => $this->hit
        ]);
    }
1331155
public function serialize()
    {
        $ns_string = '';
        foreach ($this->namespaces as $k => $v) {
            $ns_string .= "\n  xmlns:$k=\"$v\"";
        }
        $return_msg =
            '<?xml version="1.0" encoding="' . $this->soap_defencoding . '"?>' .
            '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"' . $ns_string . ">\n" .
            '<SOAP-ENV:Body>' .
            '<SOAP-ENV:Fault>' .
            $this->serialize_val($this->faultcode, 'faultcode') .
            $this->serialize_val($this->faultactor, 'faultactor') .
            $this->serialize_val($this->faultstring, 'faultstring') .
            $this->serialize_val($this->faultdetail, 'detail') .
            '</SOAP-ENV:Fault>' .
            '</SOAP-ENV:Body>' .
            '</SOAP-ENV:Envelope>';
        return $return_msg;
    }
594727
public function toString() {
        $description = $this->getDescription();
        if($description == '') {
            $description = $this->getName();
        }
        $buffer = '	/**
	 * ' . $description . "\n";
        if($this->isPrimary()) {
            $buffer .= '	 * @Primary' . "\n";
        }
        if($this->isAutoIncrementing()) {
            $buffer .= '	 * @Identity' . "\n";
        }
        $buffer .= '	 * @Column(type="' . $this->getType() . '"'
            . (!is_null($this->getLength()) ? ', length=' . $this->getLength() : '')
            . ', nullable=' . ($this->isNullable() ? 'true' : 'false') . ')' . "\n";
        $buffer .= '	 */
	' . $this->getAccess() . ' $' . $this->getName() . ';
';
        return $buffer;
    }
889134
public function jsonSerialize() {
        $data = new stdClass();
        $vars = get_object_vars($this);

        foreach ($vars as $property => $value) {
            if ($value === null) {
                continue;
            }

            $data->{$property} = $value;
        }

        return $data;
    }
859056
public function toString()
    {
        // reconstruct authority
        $authority = null;
        // there is a rendering difference between a null authority
        // (http:foo-bar) and an empty string authority
        // (http:///foo-bar).
        if (!is_null($this->host)) {
            $authority = '';
            if (!is_null($this->userinfo)) {
                $authority .= $this->userinfo . '@';
            }
            $authority .= $this->host;
            if (!is_null($this->port)) {
                $authority .= ':' . $this->port;
            }
        }

        // Reconstruct the result
        // One might wonder about parsing quirks from browsers after
        // this reconstruction.  Unfortunately, parsing behavior depends
        // on what *scheme* was employed (file:///foo is handled *very*
        // differently than http:///foo), so unfortunately we have to
        // defer to the schemes to do the right thing.
        $result = '';
        if (!is_null($this->scheme)) {
            $result .= $this->scheme . ':';
        }
        if (!is_null($authority)) {
            $result .= '//' . $authority;
        }
        $result .= $this->path;
        if (!is_null($this->query)) {
            $result .= '?' . $this->query;
        }
        if (!is_null($this->fragment)) {
            $result .= '#' . $this->fragment;
        }

        return $result;
    }