Convert comma separated list to serialized array to import as post meta

If you need to do this conversion in PHP, as part of whatever import process, then you can just convert the comma-separated values into an array with explode(), and then use update_post_meta(), which will automatically serialise the value for you:

$value="Morning,Daytime";
$array = explode( ',', $value );

update_post_meta( $post_id, 'hours_of_operation', $array );

Use trim() if your comma separated values include, or could include, spaces:

$value="Morning, Daytime";
$array = explode( ',', $value );
$array = array_map( 'trim', $array );

update_post_meta( $post_id, 'hours_of_operation', $array );

If, for whatever reason, you need to serialise the value yuorself in PHP, you can use serialize() to convert the array to a serialised string.

$value="Morning,Daytime";
$array      = explode( ',', $value );
$serialized = serialize( $array );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)