3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function chinese_date($timestamp, $output_delimiter = ' '){ $info_arr = explode(' ',date('Y m d H i s',strtotime('now'))); return implode($output_delimiter, array_map(function($v,$k){ switch($k){ case '0': // 处理年 return $v.'年'; case '1': // 处理月 return $v; default: // 不做处理的 return $v; break; } }, $info_arr, array_keys($info_arr))); } echo chinese_date('now','*');
based on imrJV
Output for 5.3.0 - 5.4.16, 5.4.18 - 5.4.27, 5.4.29 - 7.2.0
2015年*03*31*12*11*04
Output for 5.4.17, 5.4.28
2015年*03*31*12*11*05
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/kc0JK on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/kc0JK on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/kc0JK on line 5
Process exited with code 255.