3v4l.org

run code in 300+ PHP versions simultaneously
<?php $filename = "2014-01-12-a23ert78df23456ewr91234df789dfh456hj912er.txt"; $date = substr($filename, 0, 10); // 2014-01-02 $path = str_replace("-","/",$date); // 2014/01/02 echo $path;

preferences:
38.95 ms | 402 KiB | 5 Q