php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39424 Function Arguments
Submitted: 2006-11-08 07:29 UTC Modified: 2006-11-08 10:37 UTC
From: mojtaba2005sh at gmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.0 OS: Windows and Linux
Private report: No CVE-ID: None
 [2006-11-08 07:29 UTC] mojtaba2005sh at gmail dot com
Description:
------------
When I want to set a default value for a funcion and set the default value with for example 'rand(1,100)' or a class variable like '$this->m' it gives a syntax error
this was the error:
syntax error, unexpected '(', expecting ')' 

Reproduce code:
---------------
<?php

function test($m=rand(1,100)){
	echo $m;
}
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-08 10:37 UTC] bjori@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 05 22:01:31 2024 UTC