[PHP] Calling object variables is untidy and lengthy - any other ideas?
Here's the problem. I have a php script which generates a Year-on-Year change graph, works fine, does the job. I want to turn it into an object. Unfortunately I have to rename all references to variables in the object to $this-width for example. Is there a way I can just refer to them as before. With plenty of complex formulas in it, having $this- everywhere makes it a mess to look at and a nightmare to debug. Any thoughts? Chris If you are not the intended recipient of this e-mail, please preserve the confidentiality of it and advise the sender immediately of any error in transmission. Any disclosure, copying, distribution or action taken, or omitted to be taken, by an unauthorised recipient in reliance upon the contents of this e-mail is prohibited. Somerfield cannot accept liability for any damage which you may sustain as a result of software viruses so please carry out your own virus checks before opening an attachment. In replying to this e-mail you are granting the right for that reply to be forwarded to any other individual within the business and also to be read by others. Any views expressed by an individual within this message do not necessarily reflect the views of Somerfield. Somerfield reserves the right to intercept, monitor and record communications for lawful business purposes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling object variables is untidy and lengthy - any other ideas?
Hi, Tuesday, October 21, 2003, 1:46:14 AM, you wrote: cnscu Here's the problem. I have a php script which generates a Year-on-Year cnscu change graph, works fine, does the job. I want to turn it into an object. cnscu Unfortunately I have to rename all references to variables in the object to $this-width for example. Is there a way I can just refer to them as before. cnscu With plenty of complex formulas in it, having $this- everywhere makes it a cnscu mess to look at and a nightmare to debug. cnscu Any thoughts? cnscu Chris cnscu If you are not the intended recipient of this e-mail, please preserve the cnscu confidentiality of it and advise the sender immediately of any error in cnscu transmission. Any disclosure, copying, distribution or action taken, or cnscu omitted to be taken, by an unauthorised recipient in reliance upon the cnscu contents of this e-mail is prohibited. Somerfield cannot accept liability cnscu for any damage which you may sustain as a result of software viruses so cnscu please carry out your own virus checks before opening an attachment. In cnscu replying to this e-mail you are granting the right for that reply to be cnscu forwarded to any other individual within the business and also to be read by cnscu others. Any views expressed by an individual within this message do not cnscu necessarily reflect the views of Somerfield. Somerfield reserves the right cnscu to intercept, monitor and record communications for lawful business cnscu purposes. store the vars in an array, then make a referance to the array class a( var $a = array(); function a($width,$height){ $this-a['width'] = $width; $this-a['height'] = $height; } function b(){ $b = $this-a; echo 'height '.$b['height']; echo ' width '.$b['width'].'br'; } } cuts down on the $this- and maybe more readable.question of taste really :) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling object variables is untidy and lengthy - any other ideas?
On Mon, 2003-10-20 at 11:46, [EMAIL PROTECTED] wrote: Here's the problem. I have a php script which generates a Year-on-Year change graph, works fine, does the job. I want to turn it into an object. Unfortunately I have to rename all references to variables in the object to $this-width for example. Is there a way I can just refer to them as before. With plenty of complex formulas in it, having $this- everywhere makes it a mess to look at and a nightmare to debug. Any thoughts? I have one, instead of something like $this-width you can have something like $GLOBALS['width']. Personally I wouldn't recommend it, and I don't recommend turning on register globals so that you can just use $width. That said, if you have no worries about security, then go ahead and turn register globals on, then you can use $width. Mostly though, I'd just use $this-width :) Cheers, Rob. Chris If you are not the intended recipient of this e-mail, please preserve the confidentiality of it and advise the sender immediately of any error in transmission. Any disclosure, copying, distribution or action taken, or omitted to be taken, by an unauthorised recipient in reliance upon the contents of this e-mail is prohibited. Somerfield cannot accept liability for any damage which you may sustain as a result of software viruses so please carry out your own virus checks before opening an attachment. In replying to this e-mail you are granting the right for that reply to be forwarded to any other individual within the business and also to be read by others. Any views expressed by an individual within this message do not necessarily reflect the views of Somerfield. Somerfield reserves the right to intercept, monitor and record communications for lawful business purposes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php