ShoeLace1291 Posted September 12, 2010 Share Posted September 12, 2010 Is there a way to find out what the array type is? Example: $array1 = array('red', 'pizza', '14'); $array2 = array('color' => 'red', 'food' => 'pizza', 'age' => '14'); if(is_recursive($array1)){ return TRUE; } else if(is_multidimensional($array2){ return TRUE; } else { return FALSE; } Quote Link to comment https://forums.phpfreaks.com/topic/213203-php-array-type/ Share on other sites More sharing options...
trq Posted September 12, 2010 Share Posted September 12, 2010 There is always a way. You would however need to write these functions yourself. I'm not sure what the difference between is_recursive() & is_multidimensional() would be though, they sound like there pretty much describing the same thing. Quote Link to comment https://forums.phpfreaks.com/topic/213203-php-array-type/#findComment-1110165 Share on other sites More sharing options...
ignace Posted September 12, 2010 Share Posted September 12, 2010 I second what thorpe said but your function is_recursive() makes no sense at all. You can iterate recursively through an array but that doesn't make the array recursive just multi-dimensional. Quote Link to comment https://forums.phpfreaks.com/topic/213203-php-array-type/#findComment-1110167 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.