php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6566 Function default argmnt. doesn't accept variable
Submitted: 2000-09-05 23:28 UTC Modified: 2000-09-05 23:51 UTC
From: amri at easternaura dot com Assigned:
Status: Closed Package: Variables related
PHP Version: 4.0.2 OS: Redhat Linux 6.2
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: amri at easternaura dot com
New email:
PHP Version: OS:

 

 [2000-09-05 23:28 UTC] amri at easternaura dot com
Default function argument doesn't accept variable. 

function echoname ($name = 'bob') 
works fine but

$him = 'bob';
function echoname ($name = $bob)
will produce error.

I'm not sure either this is a bug or limitation but I guess its useful if variable is allowed as default function argument.

regards,
amri

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-05 23:31 UTC] amri at easternaura dot com
Default function argument doesn't accept variable. 

function echoname ($name = 'bob') 
works fine but

$bob = 'bob';
function echoname ($name = $bob)
will produce error.

I'm not sure either this is a bug or limitation but I guess its useful if variable is
allowed as default function argument.

regards,
amri

 [2000-09-05 23:50 UTC] sterling@php.net
Documented incompatibility between PHP3 & PHP4, probably will not change.
 [2000-09-05 23:51 UTC] sterling@php.net
Forgot to close.
 [2003-01-10 11:22 UTC] misc at instantmassacre dot com
Still apparant in PHP 4.2.3 and 4.3.0

As stated this behaviour is documented and will not change. Why is this?

Would Incompatibility with PHP3, being it only the minority of PHP servers are still running PHP3, be the issue?
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Mar 24 13:01:25 2019 UTC