3v4l.org

run code in 200+ PHP versions simultaneously
<?php $formatter = new IntlDateFormatter( 'ja_JP@calendar=japanese', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Europe/Madrid', IntlDateFormatter::TRADITIONAL, 'Gy年M月' ); $str = "令和元年8月"; $new = mb_ereg_replace($str , "令和元年" , "2019年"); echo $new; $ts = $formatter->parse($new); //$ts = $formatter->parse('令和元年8月'); var_dump($ts, date('Y-m', $ts));
based on v0erk
Output for 7.1.25 - 7.4.0rc2
2019年bool(false) string(7) "1970-01"