[PHP] does function extract() trim?
do not laugh, but I "discovered" today function extract(); :D before I used: foreach ($array as $key => $value) { ${$key} = trim($value); } though, "trimming" $value is kind of important to me and I would like to know if extract "trims" too? thanks. -ll Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] does function extract() trim?
On 28 Mar 2008, at 20:59, Lamp Lists wrote: do not laugh, but I "discovered" today function extract(); :D before I used: foreach ($array as $key => $value) { ${$key} = trim($value); } though, "trimming" $value is kind of important to me and I would like to know if extract "trims" too? No, but you can use http://php.net/array_map to do the trim before using extract. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] does function extract() trim?
- Original Message From: Stut <[EMAIL PROTECTED]> To: Lamp Lists <[EMAIL PROTECTED]> Cc: php General list Sent: Friday, March 28, 2008 4:02:27 PM Subject: Re: [PHP] does function extract() trim? On 28 Mar 2008, at 20:59, Lamp Lists wrote: > do not laugh, but I "discovered" today function > extract(); :D > > before I used: > foreach ($array as $key => $value) > { >${$key} = trim($value); > } > > though, "trimming" $value is kind of important to me > and I would like to know if extract "trims" too? No, but you can use http://php.net/array_map to do the trim before using extract. -Stut -- http://stut.net/ function trim_array($array_element) { $array_element = trim($array_element); return $array_element; } $myArray = array_map(trim_array, $myArray); extract($myArray); hm?!? "my way" is shorter! :D -ll Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
Re: [PHP] does function extract() trim?
On 28 Mar 2008, at 21:14, Lamp Lists wrote: - Original Message From: Stut <[EMAIL PROTECTED]> To: Lamp Lists <[EMAIL PROTECTED]> Cc: php General list Sent: Friday, March 28, 2008 4:02:27 PM Subject: Re: [PHP] does function extract() trim? On 28 Mar 2008, at 20:59, Lamp Lists wrote: > do not laugh, but I "discovered" today function > extract(); :D > > before I used: > foreach ($array as $key => $value) > { >${$key} = trim($value); > } > > though, "trimming" $value is kind of important to me > and I would like to know if extract "trims" too? No, but you can use http://php.net/array_map to do the trim before using extract. -Stut -- http://stut.net/ function trim_array($array_element) { $array_element = trim($array_element); return $array_element; } $myArray = array_map(trim_array, $myArray); extract($myArray); hm?!? "my way" is shorter! :D Only if you over-complicate it. extract(array_map('trim', $myArray)); -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] does function extract() trim?
- Original Message From: Stut <[EMAIL PROTECTED]> To: Lamp Lists <[EMAIL PROTECTED]> Cc: php General list Sent: Friday, March 28, 2008 4:22:25 PM Subject: Re: [PHP] does function extract() trim? On 28 Mar 2008, at 21:14, Lamp Lists wrote: > - Original Message > From: Stut <[EMAIL PROTECTED]> > To: Lamp Lists <[EMAIL PROTECTED]> > Cc: php General list > Sent: Friday, March 28, 2008 4:02:27 PM > Subject: Re: [PHP] does function extract() trim? > > On 28 Mar 2008, at 20:59, Lamp Lists wrote: > > do not laugh, but I "discovered" today function > > extract(); :D > > > > before I used: > > foreach ($array as $key => $value) > > { > >${$key} = trim($value); > > } > > > > though, "trimming" $value is kind of important to me > > and I would like to know if extract "trims" too? > > No, but you can use http://php.net/array_map to do the trim before > using extract. > > -Stut > > -- > http://stut.net/ > > > function trim_array($array_element) > { > $array_element = trim($array_element); > return $array_element; > } > $myArray = array_map(trim_array, $myArray); > extract($myArray); > > hm?!? "my way" is shorter! > :D Only if you over-complicate it. extract(array_map('trim', $myArray)); -Stut TOUCHE! :D I like your way. Thanks Stut! -ll You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. http://tc.deals.yahoo.com/tc/blockbuster/text5.com