Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:6328 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83807 invoked by uid 1010); 10 Dec 2003 07:38:45 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 83783 invoked from network); 10 Dec 2003 07:38:45 -0000 Received: from unknown (HELO mail.sites-secure.com) (213.189.34.71) by pb1.pair.com with SMTP; 10 Dec 2003 07:38:45 -0000 Received: by mail.sites-secure.com (CommuniGate Pro PIPE 3.5.9) with PIPE id 2090205; Wed, 10 Dec 2003 09:41:45 +0200 Received: from [192.117.106.24] (account netcat@abox.co.il HELO c15.loc) by mail.sites-secure.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 2090206; Wed, 10 Dec 2003 09:41:37 +0200 To: jason davidson Cc: internals@lists.php.net In-Reply-To: <3FD67054.2030000@zworg.com> References: <3FD67054.2030000@zworg.com> Content-Type: text/plain Message-ID: <1071041926.2830.16.camel@c15.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Wed, 10 Dec 2003 09:38:46 +0200 Content-Transfer-Encoding: 7bit X-DoalSignature: rot-3 (smtp) Subject: Re: [PHP-DEV] With End With From: netcat@abox.co.il (netcat) On Wed, 2003-12-10 at 03:01, jason davidson wrote: > Ive seen the Control Flow constuct With ...End With used in VB (yup, > VB.. :)) although im not a fan of VB, i liked the feature, is there any > consideration to this kind of construct for php. > here the only example if it i could find online for anyone that hasnt > seen it before. > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconusingwith.asp > Aside from being VB, is there anything wrong with it. > > Jason As for me - i would solve it with PHP without changing the langauge in the following way: > Sub MyInput() > With Workbooks("Book1").Worksheets("Sheet1").Cells(1, 1) > .Formula = "=SQRT(50)" > With .Font > .Name = "Arial" > .Bold = True > .Size = 8 > End With > End With > End Sub would produce somthing like: function my_input() { global $workbooks; $chg=array('formula'=>'sqrt(50)', 'font'=>array('name'=>'Arial','bold'=>true,'size'=>8)): join_properties($workbooks['book1'].workshhets['sheet1'].cells[1][1],$chg) } Here is working(not heavily tested though) example that shows the general idea: 1,'yyy'=>array('y1'=>7,'y2'=>8)); print_r($v); echo "\n"; function update_props_recursively(&$srcdst,$updater) { foreach($updater as $k=>$v) { if(is_scalar($srcdst[$k])) { $srcdst[$k]=$updater[$k]; } else { update_props_recursively($srcdst[$k],$updater[$k]); } } } $chg=array('xxx'=>2,'yyy'=>array('y2'=>99)); update_props_recursively($v,$chg); print_r($v); ?> -------------------------------------------------------- FREE 10MB email + Antivirus + AntiSpam + POP3 + more.... Get it at http://www.doal.co.il:81/free/?c=both