I want to make pagination using 2 different data source
<p>I want to pagination using 2 different data sources using PHP.</p>

<p>1, Mysql database</p>

<p>2, Text file</p>

<p>start pagination 1 page from MySQL database data and the end to text file data</p>

<p>Example: in start show data from MySQL DB and then when database data ends then show from text file</p>

<p>Example: 1 to 6 pages show data from db and after page 6 data show from text file</p>

<p>here is text file fetch code</p>

<p>Bro here is  text file fetch code</p>

<pre><code>function FetchUsernames(){
    $file_contents = file_get_contents('review_files/usernames.txt');
    $usernames  = explode("\n",$file_contents);
    shuffle($usernames);
    return $usernames;
}

function FetchReviewTitles(){
    $file_contents = file_get_contents('review_files/review_titles.txt');
    $titles  = explode("\n",$file_contents);
    shuffle($titles);
    return $titles;
}

function FetchReviews(){
    $file_contents = file_get_contents('review_files/reviews.txt');
    $reviews  = explode("|",$file_contents);
    shuffle($reviews);
    return $reviews;
}

function MergeTXTFilesData(){
  $FetchUsernames = FetchUsernames();
  $FetchReviewTitles = FetchReviewTitles();
  $FetchReviews = FetchReviews();

foreach ($FetchUsernames as $key =&gt; $username){
    if (isset($FetchReviewTitles[$key]) &amp;&amp; isset($FetchReviews[$key])){
        $Reviews[$key]['username'] = $username;
        $Reviews[$key]['title'] = $FetchReviewTitles[$key];
        $Reviews[$key]['review'] = $FetchReviews[$key];
    }
}

return $Reviews;
</code></pre>

<p>and we fetched data from mysql and paginated</p>

<p>but now we need to merge pagination</p>