Re: [RFC][DISCUSSION] Change var_export() array syntax to use short hand arrays

From: Date: Mon, 30 Mar 2020 17:42:44 +0000
Subject: Re: [RFC][DISCUSSION] Change var_export() array syntax to use short hand arrays
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-109468@lists.php.net to get a copy of this message
On Mon, Mar 30, 2020 at 12:38 PM Chase Peeler <chasepeeler@gmail.com> wrote: > Just out of curiosity, is there any reason we couldn't add an optional > parameter called "$short_array" or whatever that defaults to false? Then > there shouldn't be any backwards compatibility issues. > > None at all, though I'd make it an int $options = 0 > similar to json_encode(). I'd have a FAR easier time supporting that than a wholesale BC break for the sake of breaking BC. I can think of a few options: VAR_EXPORT_SHORT_ARRAY => use [] instead of arrray() VAR_EXPORT_NO_WHITESPACE => Keep it concise, single line VAR_EXPORT_NO_VECTOR_INDEX => If an array is vector-like, skip indexes VAR_EXPORT_UTF8_UESCAPE => Detect places where we can use \u{1234} syntax for UTF8 strings Though I'm going to stay with my stated position that I would MUCH rather this stuff live in userspace. Just because PHP's penchant for including the kitchen sink is broken already doesn't mean we should break it more. -Sara -Sara

« previous php.internals (#109468) next »