i have a multi dimensional array with 200 keys and each key have 3 to 5 array , So i want to know is there any way to see only limited part ( i.e. upto 3 or 4 keys) bcoz if i use print_r($desiredArray); then it toook too much time to print that complete array i want to see only initial 2 or 3 either first two and last two array keys

just like below

$desiredArray[0] $desiredArray[1] ... $desiredArray[199 ] $desiredArray[200]..

if key are not in order then display like below

current($desiredArray), next($desiredArray)...end($desiredArray)


Write your own function, using current(), next(), prev() and end() standard functions.

Written by biakaveron

Accepted Answer

One possible solution is installing the XDebug extension. With XDebug installed, functions like var_dump() produce nicely coloured output with protection against recursion, deep nesting or overly long output.

The quick-fix DIY alternative would be:

print_r(array_slice($desiredArray, 0, 4));
Written by Sander Marechal
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki