|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-02-09 13:00 UTC] nathan at cjhunter dot com
I'm requesting that the default function arguments for a class method be able to reference the class variable members in it's definition.
Here is an example of it's use:
class searchclass {
var $hits;
var $results;
function save($filename, $start = 0, $end = $this->hits){ /* <- this returns Parse error: */
if($fp = @fopen($filename, "w")){
for($i = $start; $i < $end; $i++){
fwrite($fp, implode("|", $this->results[$i]));
}
}else{
return false;
}
}
function search(){
/* ... */
}
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 09:00:01 2025 UTC |
$this is in execute process, function declaring is in compile process, but you can use a compiling variable: class A { const FOO = 2; public function dummy($a = FOO) { } }sorry for misspell: class A { const FOO=2; public function dummy($a = self::FOO) { } }