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. 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. 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. 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 Link to comment https://forums.phpfreaks.com/topic/238848-function-for-copyright-date/#findComment-1227277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.