note 71869 deleted from function.array-map by philip

From: Date: Thu, 22 Feb 2007 01:59:29 +0000
Subject: note 71869 deleted from function.array-map by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-123687@lists.php.net to get a copy of this message
Note Submitter: ---- 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

« previous php.notes (#123687) next »