php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13353 function calling causes error with varable
Submitted: 2001-09-17 16:26 UTC Modified: 2001-09-17 17:30 UTC
From: knightemu at yahoo dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.0.4pl1 OS: win 98 box
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:
33 + 14 = ?
Subscribe to this entry?

 
 [2001-09-17 16:26 UTC] knightemu at yahoo dot com
I am not sure if this is a bug or php is just not built to handle something like this, but when i call a function like this:

function EchoContent($BarName="Error",$body="error.inc",$topheight="100",$width=$menuwidth){

it causes an error! you cant assign a variable within the function call.

i would have to re-do it like this for it not to cause an error. 

function EchoContent($BarName="Error",$body="error.inc",$topheight="100",$width="100"){

I am sure you can see the benefits of using the top version.

     Knight

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-17 16:30 UTC] rasmus@php.net
Variable default values are not supported.  A workaround would be to assign it a bogus value and check for that in your function.

eg.

    function foo($arg=NULL) {
        if($arg==NULL) $arg = $GLOBALS['str'];
    }
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 21:01:29 2024 UTC