在特定索引上拆分大型数组()

I have a form on my site for the users to post a results report into, the report looks like this:

Nojoks's Tourney Bracket Tool Version 1.2.1.84
Tournament:  3/5 Backgammon 1:00pm
Date:  01/22/2017
Day:  Sunday
Scheduled Start:  1.00pm PST
Actual Start:  20:00:30
Closed:  20:11:00
Host:  Waiter ()
Number of Players:  15

1st place:  poppop
1st place email:  bobmitch1170@gmail.com
2nd place:  Sarge
2nd place email:  rgarvey5@hotmail.com
3rd place:  Litigolfer
3rd place email:  dostrow2008@gmail.com
3rd place:  PhantomMask
3rd place email:  

START POINTS
burnieboy 5
EU_BNL_Chris1 5
EU_IT_VIANG 5
GennaLee 5
happybear 5
MC_Vicky 5
merceaviles 5
MRC_cadet 5
poeticfool 5
UBG_Angel_D_8 5
UBG_sara1smoon 5
Litigolfer 60
PhantomMask 60
Sarge 90
poppop 120
STOP POINTS

this report is going to be identical everytime with some minor changes I have already split this into an array with explode

$records = explode( PHP_EOL, $_POST['points'] );
$records = array_map('htmlspecialchars', $records );
$records = array_map ('trim', $records);

Then i have work on collecting the information from the top of the report like so:

// Get Date
$date = substr($records[2], 7, 10);
echo "<b>Tournament Date: </b>" . $date . "<br />";
// Get star time
$start_time = substr($records[4], 18, 7);
echo "<b>Tournament Start Time: </b>" . $start_time . "<br />";

now i need to work on everything from $records[20] down what i need to do is simple enough i just do not know how to get to the correct part of my array first I used to ask my users to post only the information from the START POINTS line down to STOP POINTS so to get my information out and split was simple i used:

foreach( $records as $record ) {
    $lastSpace = strrpos( $record, ' ' );
    $player = trim( substr( $record, 0, $lastSpace ) );
    $points = trim( substr( $record, $lastSpace+1 ) );

this code will still work in this case if i can drop the index's 0 - 19 or just split the array into a new array $records1 P.S its this section in the report that is ever changing so to speak this report is from a online tournament hosting tool and each tournament has no set amount of players it can range from 8 upwards

I'm not sure I understand what you need. Perhaps something like this?

The idea is that you search for the indexes in the array which contain the start and end of the points and do a for loop to iterate only over those points.

$start = array_search("START POINTS", $records);
$end = array_search("END POINTS", $records);
$playerArray = [];

for ($i = $start+1;$i < $end;$i++) {
    $parts = explode(" ",$records[$i]);
    $player = $parts[0];
    $points = $parts[1];
    $playerArray = [ "player" => $player, "points" => $points ];         
}

I managed to work this problem out for myself with thanks to @apokryfos your code still did not do quiet what i wanted so i used your codes and added them into what i have now, Here is what i came up with:

// New try to split a full report in one go.

$points = $date = $day = $start_time = $host = $number_of_players = $fp_name = $fp_email = $sp_name = $sp_email = "";

// Explode the string at the end of each line,
// array map and remove any special chars then trim white space.

$records = explode( PHP_EOL, $_POST['points'] );
$records = array_map('htmlspecialchars', $records );
$records = array_map ('trim', $records);

// now each line of the NJ's report is in an array, call the array $records[index number] // use substr( , , ) to find the needed part of the array indexs, // I.E in the array $records on line 2 is the Date the actual needed information is the date dd/mm/yyyy, // so we use $date = substr($records[2], 7, 10); // from this string : Date: 01/18/2017 which is line 2 in records we get the 01/18/2017

// Get Date
$date = substr($records[2], 7, 10);
echo "<b>Tournament Date: </b>" . $date . "<br />";
// Get star time
$start_time = substr($records[4], 18, 7);
echo "<b>Tournament Start Time: </b>" . $start_time . "<br />";
// get Host name
$host = substr($records[7], 7);
echo "<b>Tournament Host: </b>" . $host . "<br />";
// get number of players 
$number_of_players = substr($records[8], 20);
echo "<b> Number Of Players: </b>" . $number_of_players . "<br />";
echo "<br />";
// get the first place name and email address
$fplaceName = substr($records[10], 12);
echo "<b>1ST place: </b>" . $fplaceName . "<br />";
$fplaceEmail = substr($records[11], 18);
echo "<b>1ST place Email: </b>" . $fplaceEmail . "<br />";
// Get second place name and email
$splaceName = substr($records[12], 12);
echo "<b>2ND place Email: </b>" . $splaceName . "<br />";
$splaceEmail = substr($records[13], 18);
echo "<b>2ND place Email: </b>" . $splaceEmail . "<br />";
// get third place name and email
$tplaceName = substr($records[14], 12);
echo "<b>3RD place Email: </b>" . $tplaceName . "<br />";
$tplaceEmail = substr($records[15], 18);
$t1placeEmail = "fake@fake.com";
if($tplaceEmail == "") { // if third place email is empty add a generic fake email else continue as normal
    $tplaceEmail = $t1placeEmail;
} ;
echo "<b>3RD place Email: </b>" . $tplaceEmail . "<br />";
echo "<hr /><br /><br />";


// Getting the players and points.
    $parts1 = array_slice($records, 20, -1);
    $end = array_pop($parts1);
    $records = array_map('htmlspecialchars', $records );
    $records = array_map ('trim', $records);
    foreach( $parts1 as $record ) {
    $lastSpace = strrpos( $record, ' ' );
    $player = trim( substr( $record, 0, $lastSpace ) );
    $points = trim( substr( $record, $lastSpace+1 ) );


    echo $player . " " . "  " . " " . $points . "<hr /><br />"; 
} 

so what happens is, some user pastes the report as above in my original post, and hits submit, the form posts to my processing.php page, I explode the whole post "string" into an array $records, array_map the htmlspecialchars and trim the records, then there is all the codes to extract the Date, time, host, number of players, Then we get the 1st, 2nd, 3rd names and email address's, then we get to sorting the playernames and points, array_slice from the line after STOP POINTS index[20] also -1 for the STOP POINTS index, pop the last line from the array "STOP POINTS" gone, re do the array_map's on the new array, run a foreach loop on the new array using a lastSpace strpos " " and the new array then split player name from points....

if i run the finished code on the report given in my original post you get the following output:

Music Cafe Tournament Date: 01/22/2017 Tournament Start Time: 1.00pm Tournament Host: Waiter () Number Of Players: 15

1ST place: poppop 1ST place Email: bobmitch1170@gmail.com 2ND place Email: Sarge 2ND place Email: rgarvey5@hotmail.com 3RD place Email: Litigolfer 3RD place Email: dostrow2008@gmail.com

burnieboy 5

EU_BNL_Chris1 5

EU_IT_VIANG 5

GennaLee 5

happybear 5

MC_Vicky 5

merceaviles 5

MRC_cadet 5

poeticfool 5

UBG_Angel_D_8 5

UBG_sara1smoon 5

Litigolfer 60

PhantomMask 60

Sarge 90

poppop 120

of course with the rule separating each name and points, which is what i needed and now i can add all my sql statements and bingo. please if anyone can see an easier or better way to achieve this goal i would love to see your edits and test them out