Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    May 2004
    Location
    Cockeysville Maryland (Im serious)
    Posts
    29
    Member #
    6119
    Hi,
    I'm still fairly new to PHP, and I came accross this code...

    Call:
    PHP Code:
    $myFunctionVal myFunction($var1true); 
    Header:
    PHP Code:
    function myFunction($var1$var2 false$var3 false) {
    ...

    I have 2 questions about this code:
    1.) $var2 and $var3 are assighned values in the header, what does this do?
    2.) There are 3 values in the header and 2 in the call, how does PHP handle this, and is this related to the first question?


    Thanks!

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    1. They are default values. If you omit them when calling the function, those are the values used by default.
    2. Same reason as #1.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Junior Member
    Join Date
    May 2004
    Location
    Cockeysville Maryland (Im serious)
    Posts
    29
    Member #
    6119
    Thanks!

  5. #4
    Junior Member
    Join Date
    May 2004
    Location
    Cockeysville Maryland (Im serious)
    Posts
    29
    Member #
    6119
    What Google search could I use to find more info about this?

  6. #5
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You can just ask questions here. The relevant PHP documentation: http://us4.php.net/manual/en/functions.arguments.php
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  7. #6
    Junior Member
    Join Date
    May 2004
    Location
    Cockeysville Maryland (Im serious)
    Posts
    29
    Member #
    6119
    Thanks


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:33 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com