Outputs or returns a parsable string representation of a variable.
Description
Like var_export() but "minified", using short array syntax and no newlines.
Parameters
$value
mixedrequired- The variable you want to export.
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
Version | Description |
---|---|
6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.