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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pulstar at mail dot com
New email:
PHP Version: OS:

 

 [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: Mon May 06 18:01:35 2024 UTC