note 70853 added to function.func-get-args

From: Date: Wed, 01 Nov 2006 06:26:55 +0000
Subject: note 70853 added to function.func-get-args
Groups: php.notes 
Request: Send a blank email to php-notes+get-119281@lists.php.net to get a copy of this message
Same idea as below, but this: foreach( $args as $k => $v ){ switch($k){ case 'a': $this->a= $v; break; case 'b': $this->b= $v; break; case 'c': $this->c= $v; break; } } can be shortened to this (as long as all public variables have default values set in their declarations): foreach( $args as $k=>$v) if(isset($this->$k)) $this->$k = $v; ---- Server IP: 64.71.164.2 Probable Submitter: 24.98.100.98 ---- Manual Page -- http://www.php.net/manual/en/function.func-get-args.php Edit -- https://master.php.net/note/edit/70853 Del: integrated -- https://master.php.net/note/delete/70853/integrated Del: useless -- https://master.php.net/note/delete/70853/useless Del: bad code -- https://master.php.net/note/delete/70853/bad+code Del: spam -- https://master.php.net/note/delete/70853/spam Del: non-english -- https://master.php.net/note/delete/70853/non-english Del: in docs -- https://master.php.net/note/delete/70853/in+docs Del: other reasons-- https://master.php.net/note/delete/70853 Reject -- https://master.php.net/note/reject/70853 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119281) next »