$secreq = <<<EOL
found=100
items[0].Type=dav
items[0].StartTime=2022-05-23 08:42:36
items[0].EndTime=2022-05-23 08:43:13
items[0].Disk=10
items[0].Partition=2
items[1].Type=dav
items[1].StartTime=2022-05-23 08:44:05
items[1].EndTime=2022-05-23 08:44:26
items[1].Disk=10
items[1].Partition=2
items[12].Type=dav
items[12].StartTime=2022-05-23 08:44:05
items[12].EndTime=2022-05-23 08:44:26
items[12].Disk=10
items[12].Partition=2
EOL;
preg_match_all('{items\[\d+\]\.StartTime=(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})}', $secreq, $mathes, PREG_SET_ORDER);
print_r($mathes);
Array
(
[0] => Array
(
[0] => items[0].StartTime=2022-05-23 08:42:36
[1] => 2022-05-23 08:42:36
)
[1] => Array
(
[0] => items[1].StartTime=2022-05-23 08:44:05
[1] => 2022-05-23 08:44:05
)
[2] => Array
(
[0] => items[12].StartTime=2022-05-23 08:44:05
[1] => 2022-05-23 08:44:05
)
)
$mathes[$x][1]
class Foo {
protected $bar;
function __construct($barInheritor ) {
if (is_subclass_of($barInheritor, 'Bar') {
$this->bar = new $barInheritor; }
}
function getBar( ) { return $this->bar; }
}