3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string='123412w'; $year = substr($string,0,4); $year = substr($string,4,2); echo $year;

preferences:
52.55 ms | 402 KiB | 5 Q