HDFilmMaker2112 Posted June 9, 2011 Share Posted June 9, 2011 I'm having an issue with this function: function copyyear($setyear){ $year = date('Y'); $copyrightdate="© ".$setyear; if($year!=$setyear){ $copyrightdate.=" - ".$year.""; } return $copyrightdate; } I'm echoing out the function here: <?php echo copyyear("2011"); ?> Ghost Hunter's Portal, L.L.C. This is resulting in: "Ghost Hunter's Portal, L.L.C." with no date in front of it. Quote Link to comment https://forums.phpfreaks.com/topic/238848-function-for-copyright-date/ Share on other sites More sharing options...
Pikachu2000 Posted June 9, 2011 Share Posted June 9, 2011 It works fine when I test it locally. Quote Link to comment https://forums.phpfreaks.com/topic/238848-function-for-copyright-date/#findComment-1227275 Share on other sites More sharing options...
HDFilmMaker2112 Posted June 9, 2011 Author Share Posted June 9, 2011 hmm... I made some changes to the code when I posted the thread, didn't think I changed anything to make it work; but most of. Solved. Quote Link to comment https://forums.phpfreaks.com/topic/238848-function-for-copyright-date/#findComment-1227276 Share on other sites More sharing options...
kenrbnsn Posted June 9, 2011 Share Posted June 9, 2011 This function can be written much simpler: <?php function copyyear($setyear){ return ("© $setyear" . ((date('Y') != $setyear)?" - " . date('Y'):'')); } ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/238848-function-for-copyright-date/#findComment-1227277 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.