wordpress / latest / classes / wp_debug_data / get_mysql_var.html

WP_Debug_Data::get_mysql_var( string $mysql_var ): string|null

Returns the value of a MySQL system variable.

Parameters

$mysql_var string Required
Name of the MySQL system variable.

Return

string|null The variable value on success. Null if the variable does not exist.

Source

File: wp-admin/includes/class-wp-debug-data.php. View all references

public static function get_mysql_var( $mysql_var ) {
	global $wpdb;

	$result = $wpdb->get_row(
		$wpdb->prepare( 'SHOW VARIABLES LIKE %s', $mysql_var ),
		ARRAY_A
	);

	if ( ! empty( $result ) && array_key_exists( 'Value', $result ) ) {
		return $result['Value'];
	}

	return null;
}

Uses

Uses Description

Used By

Used By Description

Changelog

Version Description
5.9.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_debug_data/get_mysql_var