RE: one-liner with strtolower and array_walk()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes, it is possible. You just need a slight modification to your code.
Try this:

[code]

$uppercase = array("ONE", "TWO");
$uppercase = array_map("strtolower", $uppercase);
print_r($uppercase);

[/code]

Shaunak Kashyap
 
Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036
 
Direct: 323.330.9870
Main: 323.330.9900
 
www.worldpokertour.com
 
Confidentiality Notice:  This e-mail transmission (and/or the
attachments accompanying) it may contain confidential information
belonging to the sender which is protected.  The information is intended
only for the use of the intended recipient.  If you are not the intended
recipient, you are hereby notified that any disclosure, copying,
distribution or taking of any action in reliance on the contents of this
information is prohibited. If you have received this transmission in
error, please notify the sender by reply e-mail and destroy all copies
of this transmission.

> -----Original Message-----
> From: Marten Lehmann [mailto:lehmann@xxxxxx]
> Sent: Wednesday, March 29, 2006 9:36 AM
> To: php-general@xxxxxxxxxxxxx
> Subject:  one-liner with strtolower and array_walk()?
> 
> Hello,
> 
> is it possible to write a one-liner like this:
> 
> $uppercase = array("ONE", "TWO");
> array_walk($uppercase, "strtolower");
> print_r($uppercase);
> 
> I don't want to do a foreach-loop on each element, putting the
lowercase
> in a new array and returning this. Is there a nicer way?
> 
> Regards
> Marten
> 
> --
> 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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux