LLMS_Abstract_Session_Data::set( string $key, mixed $value )

Set a session variable.


Parameters Parameters

$key

(string) (Required) The key of the session variable.

$value

(mixed) (Required) The value of the session variable.


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/abstracts/llms-abstract-session-data.php

	public function set( $key, $value ) {

		/**
		 * Using `isset()` allows us to explicitly save a value of `false`
		 * since the `get()` method will return the default value `false` making it look
		 * as if the value hasn't changed (when it actually has).
		 */
		if ( ! isset( $this->$key ) || $value !== $this->get( $key ) ) {
			$this->data[ sanitize_key( $key ) ] = maybe_serialize( $value );
			$this->is_clean                     = false;
		}

		return $this->get( $key );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
4.0.0 Moved from LLMS_Session.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.