array_map() the built-in function of PHP is fast and useful one.
eg1) fetching an array of integer from a textbox. [1,2,3,4]
You can get it by just a line.
$myarray = array_map( 'intval' , explode( ',' , $post_data ) ) ;
$merged_array = array_map( 'unserialize' , array_unique( array_map( 'serialize' , array_merge( $array1 , $array2 ) ) ) ) ;