WP_Translation_File_PHP::var_export()
Outputs or returns a parsable string representation of a variable.
Like {@see var_export()} but "minified", using short array syntax and no newlines.
Method of the class: WP_Translation_File_PHP{}
No Hooks.
Return
String
. The variable representation.
Usage
// private - for code of main (parent) class only $result = $this->var_export( $value ): string;
- $value(mixed) (required)
- The variable you want to export.
Changelog
Since 6.5.0 | Introduced. |
WP_Translation_File_PHP::var_export() WP Translation File PHP::var export code WP 6.6.2
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 ) . ']'; }