Thread: default values

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Location
    Rochester, NY, United States
    Posts
    9
    Rep Power
    0
    I have created a class with a constructor as so:
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    class MyClass {
    function MyClass($_m=DATE("m"),$_y=DATE("Y")) {
    /* ... */
    }
    }
    [/code]

    but that doesn't work... it also does not work in a regular function... any ideas?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Englewood, CO
    Posts
    30
    Rep Power
    15
    I'm pretty new to PHP, so maybe I'm wrong here, but is your function syntax valid? My understanding is that a function is defined in this way:

    function SomeFunction($arg1, $arg2,...$argN) {
    ...etc...
    }

    It appears you are trying to perform some formatting functions to your args instead of just taking them as is and working on them in the function.

    That could be your problem.

    -TM


    [This message has been edited by TroutMask (edited March 03, 2000).]

    [This message has been edited by TroutMask (edited March 03, 2000).]
  4. #3
  5. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Sorry, you can't call functions within an argument default.

Similar Threads

  1. Two Steps Query ?
    By Fabiop in forum MySQL Help
    Replies: 5
    Last Post: February 16th, 2004, 11:16 AM
  2. Replies: 5
    Last Post: January 11th, 2004, 08:19 PM
  3. subselect alternative needed?
    By emilyb in forum MySQL Help
    Replies: 12
    Last Post: January 10th, 2004, 09:58 AM
  4. Zip code validation
    By krwyth in forum MySQL Help
    Replies: 2
    Last Post: January 5th, 2004, 01:29 PM
  5. Need urgent help
    By nsiindia in forum MySQL Help
    Replies: 2
    Last Post: November 28th, 2003, 12:15 PM

IMN logo majestic logo threadwatch logo seochat tools logo