Copying/trimming an array to a certain size

dbirds08

New Member
I need to cut down the size of an array to get only a portion of it, but this needs to be done recursively. For example, take the following case:\[code\]$a = array( "a", "b" => array('x', 'y'), "c", "d", "e");\[/code\]what I need is that after copying only 4 elements I'll get the following resulted array:\[code\]$a = array( "a", "b" => array('x', 'y'), );\[/code\]and not...\[code\]$a = array( "a", "b" => array('x', 'y'), "c", "d",);\[/code\]How do I achieve this?Thanks!
 
Top