3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = 'write {Hello, World!} in either the color {blue} or {red} or {#00AA00} and in either the font {Arial Black} or {Monaco} where both the color and the font are determined randomly'; var_export(preg_split('~({[^}]*}|\S+)\K ~', $text));
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 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 => 'write', 1 => '{Hello, World!}', 2 => 'in', 3 => 'either', 4 => 'the', 5 => 'color', 6 => '{blue}', 7 => 'or', 8 => '{red}', 9 => 'or', 10 => '{#00AA00}', 11 => 'and', 12 => 'in', 13 => 'either', 14 => 'the', 15 => 'font', 16 => '{Arial Black}', 17 => 'or', 18 => '{Monaco}', 19 => 'where', 20 => 'both', 21 => 'the', 22 => 'color', 23 => 'and', 24 => 'the', 25 => 'font', 26 => 'are', 27 => 'determined', 28 => 'randomly', )

preferences:
576.98 ms | 409 KiB | 5 Q