php - Function showing error when trying to call -
i beginner php developer , little bit of help. trying create function , have copied code tutorial. below code:
<?php function date(); { echo date("f j, y, g:i a"); } date(); ?>
now tutorial goes should getting following output:
march 10, 2001, 5:16 pm
but getting error of:
parse error: syntax error, unexpected ';', expecting '{' in [path file]
i not sure error or doing wrong. please can help.
thanks,
ross.
edit 1:
changed code per advice. renames date() showdate() , works fine now. all.
<?php function showdate() { echo (date("f d, y")); } showdate(); ?>
first of have syntax error added semicolon after function date()
secondly should not use php in built function function name. date() php in built function.