Support » Plugins » Hacks » Get Nothing when Calling Function in PHP

  • Resolved pdxchambers


    I’m in the process of developing a calendar plugin. I have a couple of functions nextMonth() and prevMonth() that are supposed to take in an integer value for the month and year and display the calendar for the next/previous month respectively… seems pretty simple, however nothing is being displayed and I’ve run out of potential ideas…

    function nextMonth ( $month, $year) {
         if ( $month == 12 ) {
              Display_Calendar( 1, ( $year + 1 ) );
         } else {
              Display_Calendar ( ( $month + 1 ), $year) );

    The prevMonth() function is identical except it checks if the month is January and returns either December of the previous year or the previous month. I’ve already tested theDisplay_Calendar() function separately and it works perfectly fine.

    In my test code I’m calling the nextMonth() function directly:

    echo nextMonth(3, 2012);

    What I expect is to see a calendar for April 2012, but I get nothing instead. Everything seems to test out semantically, no errors in the IDE, no errors in the browser, it simply doesn’t display. Any ideas as to what might be going on here?

Viewing 1 replies (of 1 total)
  • Just realized the problem… no return statement means nothing gets output. Added return to both functions and they work!


Viewing 1 replies (of 1 total)
  • The topic ‘Get Nothing when Calling Function in PHP’ is closed to new replies.