RE: [PHP] getting values from objects
-Original Message- From: Charles Kline [mailto:[EMAIL PROTECTED] Sent: 01 April 2003 21:21 To: Dan Joseph Cc: [EMAIL PROTECTED] Subject: Re: [PHP] getting values from objects My objective was to try and NOT use a temporary variable. for example I can do this: foreach ($res_pform-getSubmitValue(investigator5) AS $k=$v){ echo $k . br; } I was just wondering in other circumstances, how I can maybe just get to the value of one of the keys without setting it first to a variable Sorry, but you can't -- the intermediate variable is the only way (because you can only apply [] to variables!). Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting values from objects
On Wednesday 02 April 2003 03:58, Charles Kline wrote: $res_pform-getSubmitValue(investigator5); returns an array, how do I get to the individual values in that array without first setting it to a variable like: $myvar = $res_pform-getSubmitValue(investigator5); echo $myvar['field']; You can try: list($field1, $field2, ...) = $res_pform-getSubmitValue(investigator5); -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* e-credibility: the non-guaranteeable likelihood that the electronic data you're seeing is genuine rather than somebody's made-up crap. - Karl Lehenbauer */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting values from objects
My objective was to try and NOT use a temporary variable. for example I can do this: foreach ($res_pform-getSubmitValue(investigator5) AS $k=$v){ echo $k . br; } I was just wondering in other circumstances, how I can maybe just get to the value of one of the keys without setting it first to a variable (which is the only way I know how to now). Thanks, Charles On Tuesday, April 1, 2003, at 03:18 PM, Dan Joseph wrote: Have you tried: extract ($myvar = $res_pform-getSubmitValue(investigator5)); -Dan Joseph -Original Message- From: Charles Kline [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 2:58 PM To: [EMAIL PROTECTED] Subject: [PHP] getting values from objects hi there, if this: $res_pform-getSubmitValue(investigator5); returns an array, how do I get to the individual values in that array without first setting it to a variable like: $myvar = $res_pform-getSubmitValue(investigator5); echo $myvar['field']; thanks charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php