note 60198 deleted from functions.arguments by nlopess

From: Date: Thu, 29 Dec 2005 17:02:01 +0000
Subject: note 60198 deleted from functions.arguments by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-100941@lists.php.net to get a copy of this message
Note Submitter: "inerte" is my gmail.com username ---- For those looking at this page for a way to use named arguments, here's an alternative. <?php class named { } $named = new named(); function foo() { global $named; if (isset($named->var)) { echo "\$var passed as an argument"; } } echo foo(); echo foo($named->var = "test"); /* Outputs: foo() called foo() called $var passed as an argument */ ?> I think it produces more readable code than using arrays or eval(). *Shameless plug*: I wrote a post about how you can use this approach more extensively (with examples too) here: http://tinyurl.com/apts7

« previous php.notes (#100941) next »