3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $celda_anio_ini = 'v.2009;2009'; $celda_anio_fin = 'v.2017;2017'; if(preg_match('/.*(Jan|Feb)?\s([\d]{4})\-/' , $celda_anio_ini, $result)) { $anio_ini = $result[2]; }elseif(preg_match('/.*[A-Za-z]{3}\s([\d]{4})\-/' , $celda_anio_ini, $result)) { $anio_ini = '('.$result[1].')'; } if(preg_match('/.*\-(Nov|Dec)?\s([\d]{4})/' , $celda_anio_fin, $result)) { $anio_fin = $result[2]; }elseif(preg_match('/.*\-[A-Za-z]{3}\s([\d]{4})/' , $celda_anio_fin, $result)) { $anio_fin = '('.$result[1].')'; } echo "$celda_anio_ini, $celda_anio_fin\n..."; echo "$anio_ini - $anio_fin\n\n";
based on h6g9r
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
v.2009;2009, v.2017;2017 ... Notice: Undefined variable: anio_ini in /in/CBTOq on line 19 Notice: Undefined variable: anio_fin in /in/CBTOq on line 19 -