Is this object member actually an array:
$tw_user_array->ids?
Array_splice is probably not what you want. That has the purpose of extracting a part of an array, and then inserting a chunk into it. Doesn't mean it won't work, but it looks to me that you probably want to use array_slice instead which is to remove a part of an array.
PHP Code:
// assuming $tw_user_array->ids member is an array:
$users_array = array_slice($tw_users_array->ids, $begin, $end);
Simple as that.
This block is unnecessary:
PHP Code:
if($i == 0) {
$begin = 0;
$end = 100;
}
else {
$begin = $i * 100;
$end = $i * 100 + 100;
};
That entire thing can be replaced with:
PHP Code:
$begin = $i * 100;
$end = $i * 100 + 100;
If $i is 0 as the first if dictates it could be, than begin and end would be 0 and 100 anyway.
Don't know anything about these objects you are using, but they may have a built in pagination functionality as well.
Also, if you are looping and breaking into chunks of 100 (you don't have anything here that shows this, but it is described as such), simply use array_chunk.
PHP Code:
$tw_user_array = $twitteroauth->get('friends/ids');
$aSplitItems = array_chunk($tw_user_array->ids, 100);
That would give a multidimensional array of 100 items per outer offset. Each inner offset would represent 100 items within it. If there is no way to filter down the results of the get method and work with how you have it designed, than using array_chunk would IMO be the simplest.