with this function
function getCRMlist( $cmd, $order, $select, $start = 0 )
{
$ret = array();
$res = CRest::call(
$cmd,
[
'order' => $order,
'select' => $select,
'start' => (int)$start
]
);
if ( count( $res ) > 0 &&
array_key_exists('result', $res) &&
!empty( $res['result'] ) &&
is_array( $res['result'] ) )
{
$total = (int)$res['total'];
$ret = array();
foreach ( $res['result'] as $key => $value ) {
$ret[$value['ID']] = $value['TITLE'];
}
if ( isset( $res['next'] ) ) {
$ret[] = getCRMlist( $cmd, $order, $select, (int)$res['next'] );
}
}
return $ret;
}
i get a result like this, with nested arrays. I want to maintain one dimension array instead. I tried several methods without accomplish the desired result with recursion. However i resolved in "pagination" way thanks to
$total = (int)$res['total'];
I would still like to know how to fix the problem through recursion. Thanks