- sscanf: documentation ( source)
- print_r: documentation ( source)
- fgets: documentation ( source)
- fopen: documentation ( source)
<?php
$str = <<<'EOD'
[2017-03-14 11:48:22] Steve T: Hi!
[2017-03-14 11:49:01] Oscar: Hi! :D How are u doin?
[2017-03-14 11:50:24] Steve T: Im doing great :P
EOD;
$handle = fopen("data://text/plain,$str", 'r');
while ( false !== $line = fgets($handle) ) {
print_r(sscanf($line, '[%[^]]] %[^:]: %[^\]'));
}