php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #10432 Functions as parameters default values
Submitted: 2001-04-21 10:19 UTC Modified: 2001-04-21 10:24 UTC
From: pulstar at mail dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.4 OS: Windows 98 4.10 english
Private report: No CVE-ID: None
 [2001-04-21 10:19 UTC] pulstar at mail dot com
function foo(parameter1, parameter2=value, parameter3=any_php_function(), parameter4=an_user_function()) {
    statments
}

Example:

function foo($anytime=FALSE) {
    if(!$anytime) $anytime=time();
    statments
}

function foo($anytime=time()) {
     statments
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-21 10:24 UTC] derick@php.net
Don't think this is neccesairy, as you can do this:

function foo ($param1 = "time")
{
    echo $param1();
}

This will execute time(); and show the response.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 10:01:31 2024 UTC