J’ai posé cette question (en anglais) à ChatGPT : Code to concat two strings with a separator but only if theses two strings are not empty in php Et il m’a répondu du très scolaire : if (!empty($str1) && !empty($str2)) { return $str1 . $separator . $str2; } return $str1 . $str2; // […]