WP_Translation_File_PHP::var_export( mixed $value ): string

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Outputs or returns a parsable string representation of a variable.

Description

Like var_export() but "minified", using short array syntax and no newlines.

Parameters

$valuemixedrequired
The variable you want to export.

Return

string The variable representation.

Source

private function var_export( $value ): string {
	if ( ! is_array( $value ) ) {
		return var_export( $value, true );
	}

	$entries = array();

	$is_list = array_is_list( $value );

	foreach ( $value as $key => $val ) {
		$entries[] = $is_list ? $this->var_export( $val ) : var_export( $key, true ) . '=>' . $this->var_export( $val );
	}

	return '[' . implode( ',', $entries ) . ']';
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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