Re: Re: [RFC] Normalize token_get_all() output (with flag)

From: Date: Tue, 05 Jan 2016 21:01:59 +0000
Subject: Re: Re: [RFC] Normalize token_get_all() output (with flag)
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-90152@lists.php.net to get a copy of this message
On Tue, Jan 5, 2016 at 12:52 PM, Andrea Faulds <ajf@ajf.me> wrote: > This is more of a side-note, but maybe it's worth bringing up. Since > token_get_all gives an array with subarrays of a regular structure, might it > be worthwhile returning an array of objects instead? It would probably > reduce memory usage (assuming they're objects of a Token class or something, > not StdClass), but I don't know if it's that useful. > Is the internal memory usage of (new stdClass) actually less than (array())? I know array changed a lot with PHP7, and that the kind of array we're talking about here is a mixed (which would be the least efficient), but I don't have the numbers to hand. To your question, I'm cool either way. Though if memory/efficiency is a concern, returning an iterator would be even better, especially on large files. Though I think that's beyond the scope of this particular RFC. Maybe I should keep up my "1 RFC per day" run and suggest TOKEN_ITERATOR as yet another flag.... Maybe not. My inbox hurts. -Sara

« previous php.internals (#90152) next »