PHP使用字母作为索引从字母和数字字符串创建关联数组

I have strings of parameters which can vary in structure, and also vary in parameter order like this:

T01
T0101
T01C0.95
T01H3000C0.95(brackets indicate a comment
T01C0.95H3000(brackets indicate a comment

This needs to be made into an array like this:

T01H3000C0.95 or T01C0.95H3000
T01[H] = 3000
T01[C] = 0.95
ignore >(brackets indicate a comment

In the case that the T section is a length of 3 or 4 characters:

T0102H3000
"T"number1.number2[CP] = number3.number4
"T"number1.number2[H] = 3000

T will always be between 1 and 4 numbers long. Periods . and spaces should not split the string.

The first section is easy because I know it will always start with T. So I can work with the string like this:

foreach($lines as $line) {
    if (substr( $line, 0, 1 ) === "T"){
    $lineArray = [];
         $trimedLine ="";
    print_r($line." - Tool Found");
    print_r("<br>");

    $trimedLine = ltrim($line, 'T');
    $lineArray = preg_split("/[a-zA-Z]/",$trimedLine,2);
    print_r("T - ".$lineArray[0]);
    print_r("<br>");    
    print_r("strlen: ".strlen($lineArray[0]));
    print_r("<br>");

    if (strlen($lineArray[0])== 1 OR strlen($lineArray[0])== 2){
     ${"T".$lineArray[0]}= [];
    print_r(${"T".$lineArray[0]});
    print_r("<br>");     
    } else {
    if (strlen($lineArray[0])== 3 OR strlen($lineArray[0])== 4)
    {   
    ${"T".$lineArray[0]}= [];   
    ${"T".$lineArray[0]}["CP"] = substr($lineArray[0], 2); 
    print_r(${"T".$lineArray[0]}["CP"]);
    print_r("<br>");        
    } else {
    print_r("Strange string size");
    print_r("<br>");    
    }
    }
    }

Afterwards it becomes more complicated. There is a chance that the index will be more than a single letter ex. SH or SP.

I could slowly cut the string down part by part by using something similar to my test code but it seems extremely convoluted.

How should I finish breaking this into an array?

Using preg_replace() and parse_str(), Here is example to start with

Demo

<?php

$input='T01H3000C0.95(brackets indicate a comment';

/* from preg_replace above input we make 
   H=3000&C=0.95&, parse_str will put it in array
*/

parse_str( 
      preg_replace("/([A-Za-z])([+-]?\d+(\.\d+)?)/",'$1=$2&',
               preg_replace('/(^T01)|(\(.*)/','',$input) 
      ), 
      $array
);

print_r($array);


?>

Output:

$ php test.php 
Array
(
    [H] => 3000
    [C] => 0.95
)