<?php
$string = ':foo!bar@cookie.net strawberry cheesecake :hello world: this is a message!';
$result = preg_split('/[^:]*:[^:]*\K /', $string, 2);
array_unshift($result, ...explode(' ', array_shift($result)));
var_export($result);
- Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- array (
0 => ':foo!bar@cookie.net',
1 => 'strawberry',
2 => 'cheesecake',
3 => ':hello world: this is a message!',
)
preferences:
70.58 ms | 406 KiB | 5 Q