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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
46 - 10 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Wed Apr 24 09:01:28 2024 UTC