3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function sub_string($string, $start, $length) { $result = substr($string,$start,$length); return $result; } $test_string = '1978-02-16'; $year = sub_string($test_string,0,4); echo $year."\r\n"; $month = sub_string($test_string,5,2); echo $month."\r\n"; $day = sub_string($test_string,8,2); echo $day."\r\n";
based on 1qblt
Output for 4.3.0 - 7.1.0
1978 02 16