List() function in PHP 5

Discussion in 'PHP' started by SeriousNovice, Jun 9, 2010.

  1. #1
    Good day, and thank you in advance for any suggestions.

    I have used the following line of code to split a date into three component parts - MM, DD and YYYY -

    list($month, $day, $year) = split('[/.-]', $fdate);

    And then I use mktime() -

    $tsfrom = mktime(0, 0, 1, "$month", "$day", "$year"); //Represent the "From Date" in a timestamp

    I wrote this for use on PHP 4 and it has worked fine. Last week, my host switched me to a new server running PHP 5. Now, it seems that the list() function no longer works. I get the following error -

    mktime() expects parameter 4 to be long, string given, then the line number

    I've experimented with this and it seems that I can no longer print the value of any of the three variables. I used to be able to do so. I've fiddled with punctuation, gone from no quotes to double quotes and back, but no luck.

    Can anyone give me a hand with this? Having searched this site and others, I don't see anything that's right on point. Thank you for your help.


    Steve E.
     
    SeriousNovice, Jun 9, 2010 IP
  2. silviuks

    silviuks Peon

    Messages:
    43
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It worked just fine for me ... see if something happened with your $fdate ...

    Apache 2.2
    PHP 5.3.0
     
    Last edited: Jun 9, 2010
    silviuks, Jun 9, 2010 IP
  3. SeriousNovice

    SeriousNovice Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you...I had another look. The value of $fdate comes to this script in a $_POST variable. I have to change how I obtain and use that value. Register_globals is off on the new server so the old code that obtains that value is probably to blame. I'll work with that today. Thank you again.


    Steve E.
     
    SeriousNovice, Jun 10, 2010 IP
  4. silviuks

    silviuks Peon

    Messages:
    43
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    good luck solving the problem ;)
     
    silviuks, Jun 10, 2010 IP