3v4l.org

run code in 300+ PHP versions simultaneously
<?php $examples = [ 'Sep 04-08', 'Sep 29-Oct 01', ]; $result = []; foreach ($examples as $example) { [$from, $to] = explode('-', $example, 2); var_export([$from, str_pad($to, 6, $from, STR_PAD_LEFT)]); echo "\n"; }
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
array ( 0 => 'Sep 04', 1 => 'Sep 08', ) array ( 0 => 'Sep 29', 1 => 'Oct 01', )

preferences:
114.78 ms | 402 KiB | 121 Q