Im getting some data trough someone elses script that forms an array I want to slice because there is a lot of old data in there and I only need the latest newest data.
Im creating an array from xml like this:
$result = (object)$SOAP->Export($token, $exportCmd, $admin);
if($result->response->code != APIResponse::Success)
die("Failed to Export");
$exportedXML = $result->exportResult;
$xml = trim(str_replace("Content-type: text/xml", " ", $exportedXML));
$xml = simplexml_load_string($xml);
$json = json_encode($xml);
$response = json_decode($json,TRUE);
If I print the response I get something like this:
Array (
[R2420] => Array (
[0] => Array ( [F2400] => 00200002 [F2425] => 01 [F2426] => 050 )
[1] => Array ( [F2001] => text [F2400] => 00200002 [F2425] => 00 [F2426] => 060 )
[2] => Array ( [F2001] => text [F2400] => 00200008 [F2425] => 01 [F2426] => 080 )
[3] => Array ( [F2001] => text [F2400] => 00200008 [F2425] => 02 [F2426] => 080 )
[4] => Array ( [F2001] => text [F2400] => 00200026 [F2425] => 00 [F2426] => 150 )
[5] => Array ( [F2400] => 00200038 [F2425] => 01 [F2426] => 330 )
)
)
This one goes to 5, the actual one till about 2000. I want for example only the last 200. But when I use $output = array_slice($response, -200, 200);
It wont slice anything off, I think thats because its an array in an array, but how do I slice that?
Thanks!