php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2385 using $variables as default value in a function doen't work
Submitted: 1999-09-26 14:36 UTC Modified: 1999-09-27 01:09 UTC
From: webmaster at retroplay dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Beta 2 OS: Linux Slackware 4.0, Kernel 2.12
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: webmaster at retroplay dot com
New email:
PHP Version: OS:

 

 [1999-09-26 14:36 UTC] webmaster at retroplay dot com
PHP reports a "parser error" in a function (at the very start of it) when I specified a default value and it is another variable (not null).
For example
#function UltimiGiorni($tabella,$foo="no",$quanti="$voci_per_pagina")
doens't work (parser error)
while
function UltimiGiorni($tabella,$foo="no",$quanti=0)
is OK.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-09-27 01:09 UTC] cslawi at cvs dot php dot net
This isn't a bug; it just doesn't work that way. For one thing, should the 
default be the value as evaluated when the function is parsed, or it's 
called? 

For more information, see the manual:

 http://www.php.net/manual/functions.arguments.php3

For ways around this, see:

 http://www.progressive-comp.com/Lists/?l=php3-general&m=91877248424055&w=2


Torben
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 18:01:29 2024 UTC