I need user to enter an array in a textarea and this array might be big array, I tried to serialize it and save it encoded in DB but it failed,
This is my code:
if( strpos( $_POST['textarea_array'], 'array' ) !== FALSE ) {
     $temp_serialized = serialize( $_POST['textarea_array'] );
     if( ( $temp_unserialized = @unserialize( $temp_serialized ) !== FALSE ) 
         && is_array( $temp_unserialized ) ) {
         /* Condition FAILED */
         $temp_json = json_encode( $temp_unserialized );
         $final_value = base64_encode( $temp_json );
     }
}
Example of what would be entered in the textarea a simple or a complicated array with sub array for each key
array( 
   'x_sub_array' => array( 
       'x_1' => 'X 1', 
       'x_2' => 'X 2', 
       'x_3' => 'X 3', 
   );
   'x_2' => 'X 2', 
   'x_3' => 'X 3', 
);
 
    