On 09/02/16 02:52, Yasuo Ohgaki wrote: > Hi, > > On Tue, Feb 9, 2016 at 1:03 AM, Kinn Julião <kin...@gmail.com> wrote: >> And what's wrong with doing: >> https://gist.github.com/kinncj/566bbc019be5707b01f2 ? > > Perfectly ok to me while it would be slower. > > BTW, it's easy and quick to detect array is real array with PHP7. > It would be handy if kind of array can be returned. It should be > different API. is_array() may be extended. > > bool is_array(mixed $var [, bool $is_real_array]); > > or > > bool is_array(mixed $var [, long $type_of_array]); > > where $type_of_array is bit flags such as PHP_ARRAY_REAL, > PHP_ARRAY_HASH, PHP_ARRAY, PHP_ARRAY_RECLUSIVE, etc.
That was what I was thinking about ... It's all very well saying that the top layer of an array is 'simple numeric', but the whole power of PHP is that each of those elements of the array can be something different so a simply boolean answer seems a little lacking? This looks like a nice alternative to adding yet more functions, but an 'array_type' function returning '$type_of_array' makes a lot of sense especially if the internal structure can maintain the information? I may not like 'strict typing' of things, but that is because I can do is_int and is_array to check for a single record id or a list of them, and is_array_simple which returns true for an array which is just a simple list of numbers or is_array_recursive for one where the list has already been expanded to a list of objects would complete my tool kit. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php