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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 22:01:27 2025 UTC