note 71869 added to function.array-map
| From: | php-general at lists dot php dot net | Date: | Wed, 20 Dec 2006 16:34:46 +0000 |
| Subject: | note 71869 added to function.array-map | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120791@lists.php.net to get a copy of this message | ||
function my_call_user_func_array( $func, $value )
{
if( function_exists( $func ) )
{
return call_user_func_array( $func, $value );
}
else
{
return $value;
}
}
function my_funcs( $func, $arr )
{
if( is_array( $arr ) )
{
$newArr = array();
foreach( $arr as $key => $value )
{
$newArr[ $key ] = ( is_array( $value ) ? my_funcs( $func, $value ) : my_call_user_func_array(
$func, $value ) );
}
}
else
{
$newArr = my_call_user_func_array( $func, $arr );
}
return $newArr;
}
$a= array("please","note", "that", "periodically");
$b = my_funcs('MD5',$a);
$c = my_funcs('ucfirst',$a);
echo $b[0] . ' - ' . $b[1]; //6050ce63e4bce6764cb34cac51fb44d1 -
aad653ca3ee669635f2938b73098b6d7
echo '<br />' . $c[0] . ' - ' . $c[1]; //Please - Note
----
Server IP: 195.222.164.18
Probable Submitter: 83.237.58.224
----
Manual Page -- http://www.php.net/manual/en/function.array-map.php
Edit -- https://master.php.net/note/edit/71869
Del: integrated -- https://master.php.net/note/delete/71869/integrated
Del: useless -- https://master.php.net/note/delete/71869/useless
Del: bad code -- https://master.php.net/note/delete/71869/bad+code
Del: spam -- https://master.php.net/note/delete/71869/spam
Del: non-english -- https://master.php.net/note/delete/71869/non-english
Del: in docs -- https://master.php.net/note/delete/71869/in+docs
Del: other reasons-- https://master.php.net/note/delete/71869
Reject -- https://master.php.net/note/reject/71869
Search -- https://master.php.net/manage/user-notes.php